From bb1660c6883fc7f391ab34a4c9a482fac3aa5823 Mon Sep 17 00:00:00 2001 From: Anton Bannykh Date: Fri, 8 Mar 2019 16:31:59 +0300 Subject: [PATCH] JS: better error reporting for V8 runner In case of stack overflow both the code and the memory release caused an exception. Only the latter was shown, and it did not contain much useful information. --- .../org/jetbrains/kotlin/js/test/JsTestChecker.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/JsTestChecker.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/JsTestChecker.kt index 8da790dc18c..3faaab73516 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/JsTestChecker.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/JsTestChecker.kt @@ -171,11 +171,19 @@ object V8IrJsTestChecker : AbstractJsTestChecker() { val v8 = ScriptEngineV8() - return try { + val v = try { files.forEach { v8.loadFile(it) } v8.f() - } finally { - v8.release() + } catch (t: Throwable) { + try { + v8.release() + } finally { + // Don't mask the original exception + throw t + } } + v8.release() + + return v } } \ No newline at end of file