diff options
Diffstat (limited to 'core/ops_builtin_v8.rs')
-rw-r--r-- | core/ops_builtin_v8.rs | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/core/ops_builtin_v8.rs b/core/ops_builtin_v8.rs index 6e8b2efda..f4133f3b8 100644 --- a/core/ops_builtin_v8.rs +++ b/core/ops_builtin_v8.rs @@ -713,22 +713,17 @@ fn op_dispatch_exception( ) { let state_rc = JsRuntime::state(scope); let mut state = state_rc.borrow_mut(); - state - .dispatched_exceptions - .push_front(v8::Global::new(scope, exception.v8_value)); - // Only terminate execution if there are no inspector sessions. - if state.inspector.is_none() { - scope.terminate_execution(); - return; - } + if let Some(inspector) = &state.inspector { + let inspector = inspector.borrow(); + // TODO(nayeemrmn): Send exception message to inspector sessions here. - // 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. + // This indicates that the op is being called from a REPL. Skip termination. + if inspector.is_dispatching_message() { + return; + } } + state.dispatched_exception = Some(v8::Global::new(scope, exception.v8_value)); + scope.terminate_execution(); } #[op(v8)] |