Is there a proper way in Kotlin-js to globally catch unhandled exception?
I have made a general attempt with window.onerror (see below). The only reported error is on non_existing_function2, but nothing is reported for the other 2 cases.
Any guidance? Thanks
window.onerror = { msg, url, line, col, error ->
window.alert(“Error: $msg \nurl: $url\nline: $line\ncol: $col\nerror: $error”)
true
}
async {
throw Exception(“generated”)
}
async {
js(“non_existing_function1();”)
}
js("non_existing_function2();")