Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
n_api: fix fatalexception handling in workers
  • Loading branch information
mafintosh committed Mar 14, 2018
commit b082520b5564bc683f7a20aa10c9f374d533d9c3
9 changes: 5 additions & 4 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3354,10 +3354,11 @@ class Work : public node::AsyncResource {
// report it as a fatal exception. (There is no JavaScript on the
// callstack that can possibly handle it.)
if (!env->last_exception.IsEmpty()) {
v8::TryCatch try_catch(env->isolate);
env->isolate->ThrowException(
v8::Local<v8::Value>::New(env->isolate, env->last_exception));
node::FatalException(env->isolate, try_catch);
v8::Local<v8::Value> err = v8::Local<v8::Value>::New(
env->isolate, env->last_exception);
v8::Local<v8::Message> msg = v8::Exception::CreateMessage(
env->isolate, err);
node::FatalException(env->isolate, err, msg);
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/node_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(err);
}

void FatalException(v8::Isolate* isolate,
v8::Local<v8::Value> error,
v8::Local<v8::Message> message);


void SignalExit(int signo);
#ifdef __POSIX__
void RegisterSignalHandler(int signal,
Expand Down