Do not swallow exception throwing IOOBE

#KTIJ-22746
This commit is contained in:
Vladimir Dolzhenko
2022-09-15 14:17:45 +02:00
committed by Space
parent 0814c0da57
commit da86e536ad
2 changed files with 11 additions and 4 deletions
@@ -242,9 +242,16 @@ public abstract class ExpressionTypingVisitorDispatcher extends KtVisitor<Kotlin
private static void logOrThrowException(@NotNull KtExpression expression, Throwable e) {
try {
String location;
try {
location = " in " + PsiDiagnosticUtils.atLocation(expression);
}
catch (Exception ex) {
location = "";
}
// This trows AssertionError in CLI and reports the error in the IDE
LOG.error(
new KotlinExceptionWithAttachments("Exception while analyzing expression at " + PsiDiagnosticUtils.atLocation(expression), e)
new KotlinExceptionWithAttachments("Exception while analyzing expression" + location, e)
.withAttachment("expression.kt", expression.getText())
);
}