diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2023-04-27 22:36:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-27 23:36:49 +0200 |
commit | 504482dadd4d8cd9e4105d56ed86802906767f39 (patch) | |
tree | acacb80e50ccfae578822dda63a3ec9e61108d60 /core/realm.rs | |
parent | 6cd62ea5e969de258b1d308daf5bec91e73e79d3 (diff) |
fix(repl): print unhandled rejections and event errors (#18878)
Fixes #8858.
Fixes #8869.
```
$ target/debug/deno
Deno 1.32.5
exit using ctrl+d, ctrl+c, or close()
REPL is running with all permissions allowed.
To specify permissions, run `deno repl` with allow flags.
> Promise.reject(new Error("bar"));
Promise { <rejected> Error: bar
at <anonymous>:2:16 }
Uncaught (in promise) Error: bar
at <anonymous>:2:16
> reportError(new Error("baz"));
undefined
Uncaught Error: baz
at <anonymous>:2:13
>
Diffstat (limited to 'core/realm.rs')
-rw-r--r-- | core/realm.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/realm.rs b/core/realm.rs index 08a550294..f907553f0 100644 --- a/core/realm.rs +++ b/core/realm.rs @@ -4,6 +4,7 @@ use crate::bindings; use crate::modules::ModuleCode; use crate::ops::OpCtx; use crate::runtime::exception_to_err_result; +use crate::JsRuntime; use anyhow::Error; use std::cell::RefCell; use std::collections::HashMap; @@ -288,6 +289,15 @@ impl<'s> JsRealmLocal<'s> { drop(context_state); let exception = v8::Local::new(scope, handle); + let state_rc = JsRuntime::state(scope); + let state = state_rc.borrow(); + if let Some(inspector) = &state.inspector { + let inspector = inspector.borrow(); + inspector.exception_thrown(scope, exception, true); + if inspector.has_blocking_sessions() { + return Ok(()); + } + } exception_to_err_result(scope, exception, true) } } |