Skip to content

Commit c064d2d

Browse files
committed
fixup: convert emit to throw
1 parent 9fcd394 commit c064d2d

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

src/node_errors.h

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ void OnFatalError(const char* location, const char* message);
5858
V(ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER, TypeError) \
5959
V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, Error) \
6060
V(ERR_VM_MODULE_CACHED_DATA_REJECTED, Error) \
61+
V(ERR_WORKER_INIT_FAILED, Error) \
6162
V(ERR_PROTO_ACCESS, Error)
6263

6364
#define V(code, type) \
@@ -107,6 +108,7 @@ void OnFatalError(const char* location, const char* message);
107108
V(ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER, \
108109
"Cannot serialize externalized SharedArrayBuffer") \
109110
V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, "Failed to set PSK identity hint") \
111+
V(ERR_WORKER_INIT_FAILED, "Worker initialization failure") \
110112
V(ERR_PROTO_ACCESS, \
111113
"Accessing Object.prototype.__proto__ has been " \
112114
"disallowed with --disable-proto=throw")

src/node_worker.cc

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)