From 79285fa83bfbbef55d8afa8f28d11ae4a0b21927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 6 Dec 2022 02:00:10 +0100 Subject: npm: ensure runtime exceptions are surfaced when debugger is attached (#16943) Currently runtime exception are only displayed at the program end in terminal, which makes it only a partial fix, as a full fix requires https://github.com/denoland/rusty_v8/pull/1149 which adds new bindings to the inspector that allows to notify it about thrown exceptions. This will be handled in a follow up commit. --- core/ops_builtin_v8.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'core') diff --git a/core/ops_builtin_v8.rs b/core/ops_builtin_v8.rs index cfbb3eba4..5f4f875ee 100644 --- a/core/ops_builtin_v8.rs +++ b/core/ops_builtin_v8.rs @@ -770,12 +770,13 @@ fn op_dispatch_exception( scope.terminate_execution(); return; } - match state.inspector().try_borrow() { - Ok(inspector) if !inspector.has_active_sessions() => { - scope.terminate_execution(); - } + + // FIXME(bartlomieju): I'm not sure if this assumption is valid... Maybe when + // inspector is polling on pause? + if state.inspector().try_borrow().is_ok() { + scope.terminate_execution(); + } else { // If the inspector is borrowed at this time, assume an inspector is active. - _ => {} } } -- cgit v1.2.3