Skip to content

Commit

Permalink
src: improve error handling in node_messaging.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Feb 26, 2025
1 parent 08d83ef commit cbbbd0e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/node_messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1627,10 +1627,15 @@ static void MessageChannel(const FunctionCallbackInfo<Value>& args) {

MessagePort::Entangle(port1, port2);

args.This()->Set(context, env->port1_string(), port1->object())
.Check();
args.This()->Set(context, env->port2_string(), port2->object())
.Check();
if (args.This()
->Set(context, env->port1_string(), port1->object())
.IsNothing() ||
args.This()
->Set(context, env->port2_string(), port2->object())
.IsNothing()) {
port1->Close();
port2->Close();
}
}

static void BroadcastChannel(const FunctionCallbackInfo<Value>& args) {
Expand Down

0 comments on commit cbbbd0e

Please sign in to comment.