Return false boolean on listen failure

This commit is contained in:
Alex Hultman 2019-01-21 19:08:18 +01:00
parent c081382f10
commit fd11df1134
2 changed files with 3 additions and 2 deletions

View File

@ -173,7 +173,8 @@ void uWS_App_listen(const FunctionCallbackInfo<Value> &args) {
int port = args[0]->Uint32Value(args.GetIsolate()->GetCurrentContext()).ToChecked();
app->listen(port, [&args](auto *token) {
Local<Value> argv[] = {External::New(isolate, token)};
/* Return a false boolean if listen failed */
Local<Value> argv[] = {token ? Local<Value>::Cast(External::New(isolate, token)) : Local<Value>::Cast(Boolean::New(isolate, false))};
Local<Function>::Cast(args[1])->Call(isolate->GetCurrentContext()->Global(), 1, argv);
});

@ -1 +1 @@
Subproject commit 74a4048195346866393a4242a2ff2ce948c11a14
Subproject commit 98d329c91241ffaa3be90740f5b3afc1608ded97