blob: ee9bc91e565e2e7c8036050d61109361ca1ee4b0 [file]
// TARGET_BACKEND: WASM
// ^^ KT-83093
// USE_NEW_EXCEPTION_HANDLING_PROPOSAL
// KT-71691
// FILE: main.kt
val globalVal: Int = throw Exception("Some")
fun main() {
result = "OK"
}
fun box() = "OK"
// FILE: result.kt
var result = "not OK"
@JsExport
fun getResult() = result
// FILE: entry.mjs
let nothrow = false;
try {
const m = await import("./index.mjs")
nothrow = true
} catch(e) {
if (!(e instanceof Error)) {
throw Error("Expected instance of Error, but '" + e.name +"' ('" + e.constructor.name + "') was received")
}
if (e.name !== "Exception" && e.message == "Some") {
throw Error("Wrong e.name = '" + e.name + "'")
}
}
if (nothrow) throw Error("Unexpected successful call");