Skip to content

Commit

Permalink
[fixup] adjustments to C++ based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
apapirovski committed Nov 19, 2017
1 parent 45a5021 commit e478850
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
19 changes: 15 additions & 4 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ bool DomainsStackHasErrorHandler(const Environment* env) {
env->context(), OneByteString(env->isolate(),
"_hasErrorListener")).ToLocalChecked();

if (has_error_handler->BooleanValue())
if (has_error_handler->IsTrue())
return true;
}

Expand Down Expand Up @@ -2426,9 +2426,8 @@ void FatalException(Isolate* isolate,
};

// this will return true if the JS layer handled it, false otherwise
Local<Value> caught = fatal_exception_function->Call(process_object,
2,
argv);
Local<Value> caught = fatal_exception_function->Call(
env->context(), process_object, 2, argv).FromMaybe(Local<Value>());

if (fatal_try_catch.HasCaught()) {
// the fatal exception function threw, so we must exit
Expand Down Expand Up @@ -2464,6 +2463,18 @@ void FatalException(Isolate* isolate,
}


void FatalException(Isolate* isolate,
const TryCatch& try_catch) {
HandleScope scope(isolate);
if (!try_catch.IsVerbose()) {
FatalException(isolate,
try_catch.Exception(),
try_catch.Message(),
true);
}
}


static void OnMessage(Local<Message> message, Local<Value> error) {
// The current version of V8 sends messages for errors only
// (thus `error` is always set).
Expand Down
7 changes: 5 additions & 2 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,11 @@ NODE_DEPRECATED("Use ParseEncoding(isolate, ...)",
})

NODE_EXTERN void FatalException(v8::Isolate* isolate,
const v8::TryCatch& try_catch,
bool should_catch = true);
const v8::TryCatch& try_catch);

void FatalException(v8::Isolate* isolate,
const v8::TryCatch& try_catch,
bool should_catch);

NODE_DEPRECATED("Use FatalException(isolate, ...)",
inline void FatalException(const v8::TryCatch& try_catch) {
Expand Down

0 comments on commit e478850

Please sign in to comment.