mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
StatementExtractor: better diagnostics if parent is unexpectedly null
Review: IDEA-CR-21189
This commit is contained in:
+4
-1
@@ -73,7 +73,10 @@ public class StatementExtractor {
|
||||
}
|
||||
parent = ObjectUtils.tryCast(parentElement, PsiExpression.class);
|
||||
if (parent == null) {
|
||||
throw new RuntimeExceptionWithAttachments("Expected to have expression parent",
|
||||
String message = PsiTreeUtil.isAncestor(root, expression, false) ?
|
||||
"Expected to have expression parent" :
|
||||
"Supplied root is not the expression ancestor";
|
||||
throw new RuntimeExceptionWithAttachments(message,
|
||||
new Attachment("expression.txt", expression.getText()),
|
||||
new Attachment("root.txt", root.getText()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user