fix trace io

This commit is contained in:
Dmitry Vasilev
2023-07-14 05:40:13 +03:00
parent 275001263f
commit e8f41d9659
2 changed files with 13 additions and 4 deletions

View File

@@ -29,7 +29,11 @@ const set_error_handler = (w, with_unhandled_rejection = true) => {
}
if(with_unhandled_rejection) {
w.addEventListener('unhandledrejection', (event) => {
ui.set_status(event.reason)
const error = event.reason
if(error.__ignore) {
return
}
ui.set_status(error)
})
}
}

View File

@@ -44,8 +44,9 @@ const make_patched_method = (original, name, use_context) => {
const method = function(...args) {
if(cxt.io_trace_is_replay_aborted) {
// Try to finish fast
// TODO invoke callback to notify that code must be restarted?
throw new Error('io replay aborted')
const error = new Error('io replay was aborted')
error.__ignore = true
throw error
}
const has_new_target = new.target != null
@@ -154,7 +155,10 @@ const make_patched_method = (original, name, use_context) => {
){
cxt.io_trace_is_replay_aborted = true
// Try to finish fast
throw new Error('io replay aborted')
// TODO invoke callback to notify that code must be restarted?
const error = new Error('io replay aborted')
error.__ignore = true
throw error
} else {
const next_resolution = cxt.io_trace.find((e, i) =>
@@ -184,6 +188,7 @@ const make_patched_method = (original, name, use_context) => {
const next_event = cxt.io_trace[cxt.io_trace_index]
if(next_event.type == 'call') {
cxt.io_trace_is_replay_aborted = true
// TODO reject? Test for never resolved
} else {
while(
cxt.io_trace_index < cxt.io_trace.length