diff --git a/src/node_errors.h b/src/node_errors.h old mode 100644 new mode 100755 index 2c421e80721484..48fcdf84867f5f --- a/src/node_errors.h +++ b/src/node_errors.h @@ -58,6 +58,7 @@ void OnFatalError(const char* location, const char* message); V(ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER, TypeError) \ V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, Error) \ V(ERR_VM_MODULE_CACHED_DATA_REJECTED, Error) \ + V(ERR_WORKER_INIT_FAILED, Error) \ V(ERR_PROTO_ACCESS, Error) #define V(code, type) \ @@ -107,6 +108,7 @@ void OnFatalError(const char* location, const char* message); V(ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER, \ "Cannot serialize externalized SharedArrayBuffer") \ V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, "Failed to set PSK identity hint") \ + V(ERR_WORKER_INIT_FAILED, "Worker initialization failure") \ V(ERR_PROTO_ACCESS, \ "Accessing Object.prototype.__proto__ has been " \ "disallowed with --disable-proto=throw") diff --git a/src/node_worker.cc b/src/node_worker.cc index d0244ae99c2329..0557247bb48756 100755 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -655,23 +655,9 @@ void Worker::StartThread(const FunctionCallbackInfo& args) { w->stopped_ = true; w->env()->remove_sub_worker_context(w); { - HandleScope handle_scope(w->env()->isolate()); - Context::Scope context_scope(w->env()->context()); - // Reset the parent port as we're closing it now anyway. - w->object()->Set(w->env()->context(), - w->env()->message_port_string(), - Undefined(w->env()->isolate())).Check(); - Local args[] = { - Integer::New(w->env()->isolate(), w->exit_code_), - w->custom_error_ != nullptr - ? OneByteString(w->env()->isolate(), w->custom_error_).As() - : Null(w->env()->isolate()).As(), - !w->custom_error_str_.empty() - ? OneByteString(w->env()->isolate(), w->custom_error_str_.c_str()) - .As() - : Null(w->env()->isolate()).As(), - }; - w->MakeCallback(w->env()->onexit_string(), arraysize(args), args); + Isolate* isolate = w->env()->isolate(); + HandleScope handle_scope(isolate); + THROW_ERR_WORKER_INIT_FAILED(isolate, err_buf); } w->MakeWeak(); }