diff --git a/src/node_messaging.cc b/src/node_messaging.cc index e430ff70f86cbb..d02a10c9740e61 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -869,7 +869,7 @@ void MessagePort::ReceiveMessage(const FunctionCallbackInfo& args) { if (!args[0]->IsObject() || !env->message_port_constructor_template()->HasInstance(args[0])) { return THROW_ERR_INVALID_ARG_TYPE(env, - "First argument needs to be a MessagePort instance"); + "The \"port\" argument must be a MessagePort instance"); } MessagePort* port = Unwrap(args[0].As()); if (port == nullptr) { @@ -890,7 +890,7 @@ void MessagePort::MoveToContext(const FunctionCallbackInfo& args) { if (!args[0]->IsObject() || !env->message_port_constructor_template()->HasInstance(args[0])) { return THROW_ERR_INVALID_ARG_TYPE(env, - "First argument needs to be a MessagePort instance"); + "The \"port\" argument must be a MessagePort instance"); } MessagePort* port = Unwrap(args[0].As()); CHECK_NOT_NULL(port); diff --git a/test/parallel/test-worker-message-port-receive-message.js b/test/parallel/test-worker-message-port-receive-message.js index e7078ea1e67ee5..8e5dc91a0790ae 100644 --- a/test/parallel/test-worker-message-port-receive-message.js +++ b/test/parallel/test-worker-message-port-receive-message.js @@ -28,6 +28,6 @@ for (const value of [null, 0, -1, {}, []]) { assert.throws(() => receiveMessageOnPort(value), { name: 'TypeError', code: 'ERR_INVALID_ARG_TYPE', - message: 'First argument needs to be a MessagePort instance' + message: 'The "port" argument must be a MessagePort instance' }); }