diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2022-04-27 00:06:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-27 01:06:10 +0200 |
commit | 9853c96cc4686a6cd1ffa1e9081c012b8df72ff7 (patch) | |
tree | c631ebfc363c06c468367be7ecd5b98110dde3a0 /core/runtime.rs | |
parent | 58eab0e2b37fd8c3c83445196d4bde419740373d (diff) |
refactor: Remove PrettyJsError and js_error_create_fn (#14378)
This commit:
- removes "fmt_errors::PrettyJsError" in favor of "format_js_error" fn
- removes "deno_core::JsError::create" and
"deno_core::RuntimeOptions::js_error_create_fn"
- adds new option to "deno_runtime::ops::worker_host::init"
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index adc0bf3ee..865995f74 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -162,7 +162,6 @@ pub(crate) struct JsRuntimeState { /// of the event loop. dyn_module_evaluate_idle_counter: u32, pub(crate) source_map_getter: Option<Box<dyn SourceMapGetter>>, - pub(crate) js_error_create_fn: Rc<JsErrorCreateFn>, pub(crate) pending_ops: FuturesUnordered<PendingOpFuture>, pub(crate) unrefed_ops: HashSet<i32>, pub(crate) have_unpolled_ops: bool, @@ -231,11 +230,6 @@ pub struct RuntimeOptions { /// Source map reference for errors. pub source_map_getter: Option<Box<dyn SourceMapGetter>>, - /// Allows a callback to be set whenever a V8 exception is made. This allows - /// the caller to wrap the JsError into an error. By default this callback - /// is set to `JsError::create()`. - pub js_error_create_fn: Option<Rc<JsErrorCreateFn>>, - /// Allows to map error type to a string "class" used to represent /// error in JavaScript. pub get_error_class_fn: Option<GetErrorClassFn>, @@ -294,10 +288,6 @@ impl JsRuntime { let has_startup_snapshot = options.startup_snapshot.is_some(); - let js_error_create_fn = options - .js_error_create_fn - .unwrap_or_else(|| Rc::new(JsError::create)); - // Add builtins extension options .extensions @@ -387,7 +377,6 @@ impl JsRuntime { has_tick_scheduled: false, js_wasm_streaming_cb: None, source_map_getter: options.source_map_getter, - js_error_create_fn, pending_ops: FuturesUnordered::new(), unrefed_ops: HashSet::new(), shared_array_buffer_store: options.shared_array_buffer_store, @@ -1062,14 +1051,13 @@ pub(crate) fn exception_to_err_result<'s, T>( js_error.exception_message.trim_start_matches("Uncaught ") ); } - let js_error = (state_rc.borrow().js_error_create_fn)(js_error); if is_terminating_exception { // Re-enable exception termination. scope.terminate_execution(); } - Err(js_error) + Err(js_error.into()) } // Related to module loading |