mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -08:00
ignore errors thrown from deferred calls
This commit is contained in:
@@ -12,6 +12,9 @@ fib(6)`
|
|||||||
const set_error_handler = (w, with_unhandled_rejection = true) => {
|
const set_error_handler = (w, with_unhandled_rejection = true) => {
|
||||||
// TODO err.message
|
// TODO err.message
|
||||||
w.onerror = (msg, src, lineNum, colNum, err) => {
|
w.onerror = (msg, src, lineNum, colNum, err) => {
|
||||||
|
if(err?.__ignore) {
|
||||||
|
return
|
||||||
|
}
|
||||||
ui.set_status(msg)
|
ui.set_status(msg)
|
||||||
}
|
}
|
||||||
if(with_unhandled_rejection) {
|
if(with_unhandled_rejection) {
|
||||||
@@ -48,6 +51,8 @@ const open_run_iframe = (state, onload) => {
|
|||||||
// Open another browser window so user can interact with application
|
// Open another browser window so user can interact with application
|
||||||
// TODO test in another browsers
|
// TODO test in another browsers
|
||||||
export const open_run_window = state => {
|
export const open_run_window = state => {
|
||||||
|
// TODO set_error_handler? Or we dont need to set_error_handler for child
|
||||||
|
// window because error is always caught by parent window handler?
|
||||||
globalThis.run_window.close()
|
globalThis.run_window.close()
|
||||||
|
|
||||||
const next_window = globalThis.run_window = open(get_html_url(state))
|
const next_window = globalThis.run_window = open(get_html_url(state))
|
||||||
|
|||||||
@@ -326,6 +326,11 @@ const __trace = (cxt, fn, name, argscount, __location, get_closure) => {
|
|||||||
ok = false
|
ok = false
|
||||||
error = _error
|
error = _error
|
||||||
set_record_call(cxt)
|
set_record_call(cxt)
|
||||||
|
if(cxt.is_recording_deferred_calls && is_toplevel_call_copy) {
|
||||||
|
if(error instanceof cxt.window.Error) {
|
||||||
|
error.__ignore = true
|
||||||
|
}
|
||||||
|
}
|
||||||
throw error
|
throw error
|
||||||
} finally {
|
} finally {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user