@@ -655,23 +655,9 @@ void Worker::StartThread(const FunctionCallbackInfo<Value>& args) {
655655 w->stopped_ = true ;
656656 w->env ()->remove_sub_worker_context (w);
657657 {
658- HandleScope handle_scope (w->env ()->isolate ());
659- Context::Scope context_scope (w->env ()->context ());
660- // Reset the parent port as we're closing it now anyway.
661- w->object ()->Set (w->env ()->context (),
662- w->env ()->message_port_string (),
663- Undefined (w->env ()->isolate ())).Check ();
664- Local<Value> args[] = {
665- Integer::New (w->env ()->isolate (), w->exit_code_ ),
666- w->custom_error_ != nullptr
667- ? OneByteString (w->env ()->isolate (), w->custom_error_ ).As <Value>()
668- : Null (w->env ()->isolate ()).As <Value>(),
669- !w->custom_error_str_ .empty ()
670- ? OneByteString (w->env ()->isolate (), w->custom_error_str_ .c_str ())
671- .As <Value>()
672- : Null (w->env ()->isolate ()).As <Value>(),
673- };
674- w->MakeCallback (w->env ()->onexit_string (), arraysize (args), args);
658+ Isolate* isolate = w->env ()->isolate ();
659+ HandleScope handle_scope (isolate);
660+ THROW_ERR_WORKER_INIT_FAILED (isolate, err_buf);
675661 }
676662 w->MakeWeak ();
677663 }
0 commit comments