Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

worker: mention argument name in type check message #32815

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/node_messaging.cc
Expand Up @@ -869,7 +869,7 @@ void MessagePort::ReceiveMessage(const FunctionCallbackInfo<Value>& 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<MessagePort>(args[0].As<Object>());
if (port == nullptr) {
Expand All @@ -890,7 +890,7 @@ void MessagePort::MoveToContext(const FunctionCallbackInfo<Value>& 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<MessagePort>(args[0].As<Object>());
CHECK_NOT_NULL(port);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-worker-message-port-receive-message.js
Expand Up @@ -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'
});
}