mirror of
https://github.com/nodejs/node.git
synced 2025-05-21 08:27:49 +00:00
worker: mention argument name in type check message
Refs: https://github.com/nodejs/node/pull/32745#discussion_r406564208 PR-URL: https://github.com/nodejs/node/pull/32815 Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
parent
953445873a
commit
d699fdd2c6
@ -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) {
|
||||
@ -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);
|
||||
|
@ -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'
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user