mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05: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:
1 parent
2662b0c9e3
commit
7fe61222ef
2 files changed
+3
-3
No files matched your search
@@ -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'
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user