summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/worker.rs13
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;