Skip to content

Commit

Permalink
worker: mention argument name in type check message
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Apr 13, 2020
1 parent a46345d commit ee7caf5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/node_messaging.cc
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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'
});
}

0 comments on commit ee7caf5

Please sign in to comment.