Skip to content

Commit

Permalink
fixup: convert emit to throw
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshithaKP committed Mar 21, 2020
1 parent 9fcd394 commit c064d2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/node_errors.h 100644 → 100755
Expand Up @@ -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) \
Expand Down Expand Up @@ -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")
Expand Down
20 changes: 3 additions & 17 deletions src/node_worker.cc
Expand Up @@ -655,23 +655,9 @@ void Worker::StartThread(const FunctionCallbackInfo<Value>& 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<Value> args[] = {
Integer::New(w->env()->isolate(), w->exit_code_),
w->custom_error_ != nullptr
? OneByteString(w->env()->isolate(), w->custom_error_).As<Value>()
: Null(w->env()->isolate()).As<Value>(),
!w->custom_error_str_.empty()
? OneByteString(w->env()->isolate(), w->custom_error_str_.c_str())
.As<Value>()
: Null(w->env()->isolate()).As<Value>(),
};
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();
}
Expand Down

0 comments on commit c064d2d

Please sign in to comment.