diff --git a/library/src/commonTest/kotlin/ScriptTest.kt b/library/src/commonTest/kotlin/ScriptTest.kt index 7dad62e..5d4136d 100644 --- a/library/src/commonTest/kotlin/ScriptTest.kt +++ b/library/src/commonTest/kotlin/ScriptTest.kt @@ -1854,4 +1854,26 @@ class ScriptTest { """.trimIndent()) } + @Test + fun testThrowFromKotlin() = runTest { + val c = Context() + c.addFn("callThrow") { + raiseArgumentError("fromKotlin") + } + c.eval(""" + val result = try { + callThrow() + "fail" + } + catch(e) { + println("caught:"+e) + println(e.message) + assert( e is IllegalArgumentException ) + assertEquals("fromKotlin", e.message) + "ok" + } + assertEquals(result, "ok") + """.trimIndent()) + } + } \ No newline at end of file