diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-09-15 03:23:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-14 21:23:48 -0400 |
commit | 7023263b304c7020f6d4413c0f48a5f7fb5675e2 (patch) | |
tree | e2dfcf86053085890f1361b0896aa46345346ae7 /cli/worker.rs | |
parent | 9b8f1d9be880a1f550de7ef7e339c3c58b6bb7ca (diff) |
refactor(core): remove JsRuntime::set_js_error_create_fn (#7478)
Instead use RuntimeOptions.js_error_create_fn
Diffstat (limited to 'cli/worker.rs')
-rw-r--r-- | cli/worker.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/cli/worker.rs b/cli/worker.rs index 1265dedb4..4141d5008 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -106,20 +106,17 @@ impl Worker { startup_snapshot: Option<Snapshot>, state: &Rc<CliState>, ) -> Self { + let global_state = state.global_state.clone(); + let mut isolate = JsRuntime::new(RuntimeOptions { module_loader: Some(state.clone()), startup_snapshot, + js_error_create_fn: Some(Box::new(move |core_js_error| { + JsError::create(core_js_error, &global_state.ts_compiler) + })), ..Default::default() }); { - let global_state = state.global_state.clone(); - let js_runtime_state = JsRuntime::state(&isolate); - let mut js_runtime_state = js_runtime_state.borrow_mut(); - js_runtime_state.set_js_error_create_fn(move |core_js_error| { - JsError::create(core_js_error, &global_state.ts_compiler) - }); - } - { let op_state = isolate.op_state(); let mut op_state = op_state.borrow_mut(); op_state.get_error_class_fn = &crate::errors::get_error_class_name; |