◐ Shell
clean mode source ↗

src: improve error handling in `node_messaging.cc` · nodejs/node@185d1ff

Original file line numberDiff line numberDiff line change

@@ -1627,10 +1627,15 @@ static void MessageChannel(const FunctionCallbackInfo<Value>& args) {

16271627
16281628

MessagePort::Entangle(port1, port2);

16291629
1630-

args.This()->Set(context, env->port1_string(), port1->object())

1631-

.Check();

1632-

args.This()->Set(context, env->port2_string(), port2->object())

1633-

.Check();

1630+

if (args.This()

1631+

->Set(context, env->port1_string(), port1->object())

1632+

.IsNothing() ||

1633+

args.This()

1634+

->Set(context, env->port2_string(), port2->object())

1635+

.IsNothing()) {

1636+

port1->Close();

1637+

port2->Close();

1638+

}

16341639

}

16351640
16361641

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