src: improve error handling in node_messaging.cc

PR-URL: https://github.com/nodejs/node/pull/57211
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
James M Snell authored and RafaelGSS committed 2025-05-02 17:04:39 -03:00
1 parent 7cfad4c492
commit 32243bbfbe
1 file changed
+9 -4
+9 -4
View File
@@ -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) {