From e8f41d9659c51575851d6837804ce3a9fbee890b Mon Sep 17 00:00:00 2001 From: Dmitry Vasilev Date: Fri, 14 Jul 2023 05:40:13 +0300 Subject: [PATCH] fix trace io --- src/index.js | 6 +++++- src/record_io.js | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 65f33df..a0a6242 100644 --- a/src/index.js +++ b/src/index.js @@ -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) }) } } diff --git a/src/record_io.js b/src/record_io.js index ed208e1..d98dc54 100644 --- a/src/record_io.js +++ b/src/record_io.js @@ -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