mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
errors,process: fix error message of hrtime()
process.hrtime() incorrectly passed the function name to errors.TypeError instead of the name of the argument. Additionally, the type of the actual argument was added to the error message and a new error code ERR_INVALID_ARRAY_LENGTH was added. PR-URL: https://github.com/nodejs/node/pull/13739 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
1 parent
d2913384aa
commit
a0f7284346
3 files changed
+41
-17
No files matched your search
@@ -122,6 +122,15 @@ E('ERR_HTTP_INVALID_CHAR', 'Invalid character in statusMessage.');
|
||||
E('ERR_HTTP_INVALID_STATUS_CODE',
|
||||
(originalStatusCode) => `Invalid status code: ${originalStatusCode}`);
|
||||
E('ERR_INDEX_OUT_OF_RANGE', 'Index out of range');
|
||||
E('ERR_INVALID_ARRAY_LENGTH',
|
||||
(name, length, actual) => {
|
||||
let msg = `The "${name}" array must have a length of ${length}`;
|
||||
if (arguments.length > 2) {
|
||||
const len = Array.isArray(actual) ? actual.length : actual;
|
||||
msg += `. Received length ${len}`;
|
||||
}
|
||||
return msg;
|
||||
});
|
||||
E('ERR_INVALID_ARG_TYPE', invalidArgType);
|
||||
E('ERR_INVALID_CALLBACK', 'callback must be a function');
|
||||
E('ERR_INVALID_FD', (fd) => `"fd" must be a positive integer: ${fd}`);
|
||||
|
||||
Reference in new issue
Block a user