summaryrefslogtreecommitdiff
path: root/core/runtime.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2022-06-06 19:26:57 +0100
committerGitHub <noreply@github.com>2022-06-06 20:26:57 +0200
commite3eae662f3d753141571bd132ccb199f95c745ea (patch)
treee0cdad78f409c9b221b909d0d7dfcee286e6325f /core/runtime.rs
parent1081659be176a59512a7e9e3dc93e13046a26aec (diff)
fix: Format non-error exceptions (#14604)
This commit adds "Deno.core.setFormatExceptionCallback" which can be used to provide custom formatting for errors. It is useful in cases when user throws something that is non-Error (eg. a string, plain object, etc).
Diffstat (limited to 'core/runtime.rs')
-rw-r--r--core/runtime.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/runtime.rs b/core/runtime.rs
index 3578b216a..66d28226e 100644
--- a/core/runtime.rs
+++ b/core/runtime.rs
@@ -152,6 +152,7 @@ pub(crate) struct JsRuntimeState {
pub(crate) js_nexttick_cbs: Vec<v8::Global<v8::Function>>,
pub(crate) js_promise_reject_cb: Option<v8::Global<v8::Function>>,
pub(crate) js_uncaught_exception_cb: Option<v8::Global<v8::Function>>,
+ pub(crate) js_format_exception_cb: Option<v8::Global<v8::Function>>,
pub(crate) has_tick_scheduled: bool,
pub(crate) js_wasm_streaming_cb: Option<v8::Global<v8::Function>>,
pub(crate) pending_promise_exceptions:
@@ -386,6 +387,7 @@ impl JsRuntime {
js_nexttick_cbs: vec![],
js_promise_reject_cb: None,
js_uncaught_exception_cb: None,
+ js_format_exception_cb: None,
has_tick_scheduled: false,
js_wasm_streaming_cb: None,
source_map_getter: options.source_map_getter,