diff --git a/doc/api/errors.md b/doc/api/errors.md
index 99c830b895cbd1..422d41348204bd 100644
--- a/doc/api/errors.md
+++ b/doc/api/errors.md
@@ -1078,11 +1078,6 @@ An argument of the wrong type was passed to a Node.js API.
An invalid or unsupported value was passed for a given argument.
-
-### ERR_INVALID_ARRAY_LENGTH
-
-An array was not of the expected length or in a valid range.
-
### ERR_INVALID_ASYNC_ID
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
index 0228448dbf3f58..de4a566af4d889 100644
--- a/lib/internal/errors.js
+++ b/lib/internal/errors.js
@@ -865,10 +865,6 @@ E('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => {
}
return `The argument '${name}' ${reason}. Received ${inspected}`;
}, TypeError, RangeError);
-E('ERR_INVALID_ARRAY_LENGTH',
- (name, len, actual) => {
- return `The array "${name}" (length ${actual}) must be of length ${len}.`;
- }, TypeError);
E('ERR_INVALID_ASYNC_ID', 'Invalid %s value: %s', RangeError);
E('ERR_INVALID_BUFFER_SIZE',
'Buffer size must be a multiple of %s', RangeError);
diff --git a/lib/internal/process.js b/lib/internal/process.js
index f72043264ff80c..cc8318cbe3ce53 100644
--- a/lib/internal/process.js
+++ b/lib/internal/process.js
@@ -6,8 +6,8 @@ const {
ERR_ASSERTION,
ERR_CPU_USAGE,
ERR_INVALID_ARG_TYPE,
- ERR_INVALID_ARRAY_LENGTH,
ERR_INVALID_OPT_VALUE,
+ ERR_OUT_OF_RANGE,
ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET,
ERR_UNKNOWN_SIGNAL
}
@@ -108,7 +108,7 @@ function setup_hrtime() {
throw new ERR_INVALID_ARG_TYPE('time', 'Array', time);
}
if (time.length !== 2) {
- throw new ERR_INVALID_ARRAY_LENGTH('time', 2, time.length);
+ throw new ERR_OUT_OF_RANGE('time', 2, time.length);
}
const sec = (hrValues[0] * 0x100000000 + hrValues[1]) - time[0];
diff --git a/test/parallel/test-process-hrtime.js b/test/parallel/test-process-hrtime.js
index 1d2d2ecde9da2b..81e50ccb7f85f0 100644
--- a/test/parallel/test-process-hrtime.js
+++ b/test/parallel/test-process-hrtime.js
@@ -23,16 +23,16 @@
const common = require('../common');
const assert = require('assert');
-// the default behavior, return an Array "tuple" of numbers
+// The default behavior, return an Array "tuple" of numbers
const tuple = process.hrtime();
-// validate the default behavior
+// Validate the default behavior
validateTuple(tuple);
-// validate that passing an existing tuple returns another valid tuple
+// Validate that passing an existing tuple returns another valid tuple
validateTuple(process.hrtime(tuple));
-// test that only an Array may be passed to process.hrtime()
+// Test that only an Array may be passed to process.hrtime()
common.expectsError(() => {
process.hrtime(1);
}, {
@@ -43,23 +43,23 @@ common.expectsError(() => {
common.expectsError(() => {
process.hrtime([]);
}, {
- code: 'ERR_INVALID_ARRAY_LENGTH',
- type: TypeError,
- message: 'The array "time" (length 0) must be of length 2.'
+ code: 'ERR_OUT_OF_RANGE',
+ type: RangeError,
+ message: 'The value of "time" is out of range. It must be 2. Received 0'
});
common.expectsError(() => {
process.hrtime([1]);
}, {
- code: 'ERR_INVALID_ARRAY_LENGTH',
- type: TypeError,
- message: 'The array "time" (length 1) must be of length 2.'
+ code: 'ERR_OUT_OF_RANGE',
+ type: RangeError,
+ message: 'The value of "time" is out of range. It must be 2. Received 1'
});
common.expectsError(() => {
process.hrtime([1, 2, 3]);
}, {
- code: 'ERR_INVALID_ARRAY_LENGTH',
- type: TypeError,
- message: 'The array "time" (length 3) must be of length 2.'
+ code: 'ERR_OUT_OF_RANGE',
+ type: RangeError,
+ message: 'The value of "time" is out of range. It must be 2. Received 3'
});
function validateTuple(tuple) {
@@ -70,4 +70,4 @@ function validateTuple(tuple) {
}
const diff = process.hrtime([0, 1e9 - 1]);
-assert(diff[1] >= 0); // https://github.com/nodejs/node/issues/4751
+assert(diff[1] >= 0); // https://github.com/nodejs/node/issues/4751