diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/state/ExceptionState.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/state/ExceptionState.kt index 67b4442ad3e..7a153eeace0 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/state/ExceptionState.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/state/ExceptionState.kt @@ -92,16 +92,16 @@ internal class ExceptionState private constructor( } fun getShortDescription(): String { - return message.let { if (it?.isNotEmpty() == true) it else "???" } + val message = message.let { if (it?.isNotEmpty() == true) ": $it" else "" } + return "Exception $exceptionFqName$message" } fun getFullDescription(): String { // TODO remainder of the stack trace with "..." - val message = message.let { if (it?.isNotEmpty() == true) ": $it" else "" } val prefix = if (stackTrace.isNotEmpty()) "\n\t" else "" val postfix = if (stackTrace.size > 10) "\n\t..." else "" val causeMessage = cause?.getFullDescription()?.replaceFirst("Exception ", "\nCaused by: ") ?: "" - return "Exception $exceptionFqName$message" + + return getShortDescription() + stackTrace.subList(0, min(stackTrace.size, 10)).joinToString(separator = "\n\t", prefix = prefix, postfix = postfix) + causeMessage } diff --git a/compiler/testData/diagnostics/irInterpreter/exceptionFromInterpreter.fir.ir.diag.txt b/compiler/testData/diagnostics/irInterpreter/exceptionFromInterpreter.fir.ir.diag.txt index a7dd3c6a941..1e6584981d7 100644 --- a/compiler/testData/diagnostics/irInterpreter/exceptionFromInterpreter.fir.ir.diag.txt +++ b/compiler/testData/diagnostics/irInterpreter/exceptionFromInterpreter.fir.ir.diag.txt @@ -1,5 +1,5 @@ -/exceptionFromInterpreter.kt:(197,200): error: Cannot evaluate constant expression: / by zero +/exceptionFromInterpreter.kt:(197,200): error: Cannot evaluate constant expression: Exception java.lang.ArithmeticException: / by zero -/exceptionFromInterpreter.kt:(239,254): error: Cannot evaluate constant expression: marginPrefix must be non-blank string. +/exceptionFromInterpreter.kt:(239,254): error: Cannot evaluate constant expression: Exception java.lang.IllegalArgumentException: marginPrefix must be non-blank string. -/exceptionFromInterpreter.kt:(305,308): error: Cannot evaluate constant expression: / by zero +/exceptionFromInterpreter.kt:(305,308): error: Cannot evaluate constant expression: Exception java.lang.ArithmeticException: / by zero diff --git a/compiler/testData/diagnostics/irInterpreter/recursionAccess.fir.ir.diag.txt b/compiler/testData/diagnostics/irInterpreter/recursionAccess.fir.ir.diag.txt index 33502ef695d..e5946ad9dd3 100644 --- a/compiler/testData/diagnostics/irInterpreter/recursionAccess.fir.ir.diag.txt +++ b/compiler/testData/diagnostics/irInterpreter/recursionAccess.fir.ir.diag.txt @@ -1,3 +1,3 @@ -/recursionAccess.kt:(180,194): error: Cannot evaluate constant expression: ??? +/recursionAccess.kt:(180,194): error: Cannot evaluate constant expression: Exception java.lang.StackOverflowError -/recursionAccess.kt:(280,283): error: Cannot evaluate constant expression: ??? +/recursionAccess.kt:(280,283): error: Cannot evaluate constant expression: Exception java.lang.NullPointerException