summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWeijia Wang <381152119@qq.com>2017-12-13 20:48:43 +0800
committerWeijia Wang <381152119@qq.com>2017-12-24 14:09:29 +0800
commitd022cb1bdd20f10483cbe988a950548df2dfd48c (patch)
treee10d1a2c2d4957ef123a8aaadb9727bf674c00ae /test
parent4d74b52979c60391bc369be69a34463eba61f383 (diff)
downloadandroid-node-v8-d022cb1bdd20f10483cbe988a950548df2dfd48c.tar.gz
android-node-v8-d022cb1bdd20f10483cbe988a950548df2dfd48c.tar.bz2
android-node-v8-d022cb1bdd20f10483cbe988a950548df2dfd48c.zip
lib: combine similar error codes
There two similar error codes in lib: "ERR_VALUE_OUT_OF_RANGE" and "ERR_OUT_OF_RANGE". This change is to reduce them into "ERR_VALUE_OUT_OF_RANGE" Fixes: https://github.com/nodejs/node/issues/17603 PR-URL: https://github.com/nodejs/node/pull/17648 Fixes: https://github.com/nodejs/node/issues/17603 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-child-process-spawnsync-validation-errors.js2
-rw-r--r--test/parallel/test-crypto-pbkdf2.js5
-rw-r--r--test/parallel/test-crypto-random.js16
-rw-r--r--test/parallel/test-event-emitter-max-listeners.js10
-rw-r--r--test/parallel/test-file-write-stream3.js5
-rw-r--r--test/parallel/test-fs-read-stream-inherit.js5
-rw-r--r--test/parallel/test-fs-read-stream.js6
-rw-r--r--test/parallel/test-internal-errors.js14
-rw-r--r--test/parallel/test-timers-enroll-invalid-msecs.js7
9 files changed, 43 insertions, 27 deletions
diff --git a/test/parallel/test-child-process-spawnsync-validation-errors.js b/test/parallel/test-child-process-spawnsync-validation-errors.js
index 7e38b549dc..433e0fce16 100644
--- a/test/parallel/test-child-process-spawnsync-validation-errors.js
+++ b/test/parallel/test-child-process-spawnsync-validation-errors.js
@@ -15,7 +15,7 @@ if (common.isWindows) {
}
const invalidRangeError =
- common.expectsError({ code: 'ERR_VALUE_OUT_OF_RANGE', type: RangeError }, 20);
+ common.expectsError({ code: 'ERR_OUT_OF_RANGE', type: RangeError }, 20);
function pass(option, value) {
// Run the command with the specified option. Since it's not a real command,
diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js
index af8acd42c7..3576b69301 100644
--- a/test/parallel/test-crypto-pbkdf2.js
+++ b/test/parallel/test-crypto-pbkdf2.js
@@ -70,7 +70,8 @@ common.expectsError(
{
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The "iterations" argument is out of range'
+ message: 'The value of "iterations" is out of range. ' +
+ 'It must be a non-negative number. Received -1'
}
);
@@ -93,7 +94,7 @@ common.expectsError(
}, {
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The "keylen" argument is out of range'
+ message: 'The value of "keylen" is out of range.'
});
});
diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js
index 3926eb3850..a8f21cb4fe 100644
--- a/test/parallel/test-crypto-random.js
+++ b/test/parallel/test-crypto-random.js
@@ -291,7 +291,7 @@ process.setMaxListeners(256);
{
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The "offset" argument is out of range'
+ message: 'The value of "offset" is out of range.'
}
);
@@ -300,7 +300,7 @@ process.setMaxListeners(256);
{
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The "offset" argument is out of range'
+ message: 'The value of "offset" is out of range.'
}
);
@@ -309,7 +309,7 @@ process.setMaxListeners(256);
{
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The "offset" argument is out of range'
+ message: 'The value of "offset" is out of range.'
}
);
@@ -318,7 +318,7 @@ process.setMaxListeners(256);
{
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The "offset" argument is out of range'
+ message: 'The value of "offset" is out of range.'
}
);
@@ -421,7 +421,7 @@ process.setMaxListeners(256);
{
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The "size" argument is out of range'
+ message: 'The value of "size" is out of range.'
}
);
@@ -430,7 +430,7 @@ process.setMaxListeners(256);
{
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The "size" argument is out of range'
+ message: 'The value of "size" is out of range.'
}
);
@@ -439,7 +439,7 @@ process.setMaxListeners(256);
{
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The "size" argument is out of range'
+ message: 'The value of "size" is out of range.'
}
);
@@ -448,7 +448,7 @@ process.setMaxListeners(256);
{
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The "size" argument is out of range'
+ message: 'The value of "size" is out of range.'
}
);
diff --git a/test/parallel/test-event-emitter-max-listeners.js b/test/parallel/test-event-emitter-max-listeners.js
index 319e0dffd6..a906000477 100644
--- a/test/parallel/test-event-emitter-max-listeners.js
+++ b/test/parallel/test-event-emitter-max-listeners.js
@@ -36,8 +36,9 @@ for (const obj of throwsObjs) {
() => e.setMaxListeners(obj),
{
code: 'ERR_OUT_OF_RANGE',
- type: TypeError,
- message: 'The "n" argument is out of range'
+ type: RangeError,
+ message: 'The value of "n" is out of range. ' +
+ `It must be a non-negative number. Received ${obj}`
}
);
@@ -45,8 +46,9 @@ for (const obj of throwsObjs) {
() => events.defaultMaxListeners = obj,
{
code: 'ERR_OUT_OF_RANGE',
- type: TypeError,
- message: 'The "defaultMaxListeners" argument is out of range'
+ type: RangeError,
+ message: 'The value of "defaultMaxListeners" is out of range. ' +
+ `It must be a non-negative number. Received ${obj}`
}
);
}
diff --git a/test/parallel/test-file-write-stream3.js b/test/parallel/test-file-write-stream3.js
index cdc01e8733..4bf7b88ff1 100644
--- a/test/parallel/test-file-write-stream3.js
+++ b/test/parallel/test-file-write-stream3.js
@@ -180,8 +180,9 @@ const run_test_4 = common.mustCall(function() {
fs.createWriteStream(filepath, { start: -5, flags: 'r+' });
};
const err = {
- code: 'ERR_VALUE_OUT_OF_RANGE',
- message: 'The value of "start" must be >= 0. Received "{start: -5}"',
+ code: 'ERR_OUT_OF_RANGE',
+ message: 'The value of "start" is out of range. ' +
+ 'It must be >= 0. Received {start: -5}',
type: RangeError
};
common.expectsError(block, err);
diff --git a/test/parallel/test-fs-read-stream-inherit.js b/test/parallel/test-fs-read-stream-inherit.js
index 6a83dd4eb4..f43f81ddee 100644
--- a/test/parallel/test-fs-read-stream-inherit.js
+++ b/test/parallel/test-fs-read-stream-inherit.js
@@ -110,14 +110,15 @@ const rangeFile = fixtures.path('x.txt');
{
const message =
- 'The value of "start" must be <= "end". Received "{start: 10, end: 2}"';
+ 'The value of "start" is out of range. It must be <= "end". ' +
+ 'Received {start: 10, end: 2}';
common.expectsError(
() => {
fs.createReadStream(rangeFile, Object.create({ start: 10, end: 2 }));
},
{
- code: 'ERR_VALUE_OUT_OF_RANGE',
+ code: 'ERR_OUT_OF_RANGE',
message,
type: RangeError
});
diff --git a/test/parallel/test-fs-read-stream.js b/test/parallel/test-fs-read-stream.js
index ecc00edc85..1b9cc4aa90 100644
--- a/test/parallel/test-fs-read-stream.js
+++ b/test/parallel/test-fs-read-stream.js
@@ -145,9 +145,9 @@ common.expectsError(
fs.createReadStream(rangeFile, { start: 10, end: 2 });
},
{
- code: 'ERR_VALUE_OUT_OF_RANGE',
- message:
- 'The value of "start" must be <= "end". Received "{start: 10, end: 2}"',
+ code: 'ERR_OUT_OF_RANGE',
+ message: 'The value of "start" is out of range. It must be <= "end". ' +
+ 'Received {start: 10, end: 2}',
type: RangeError
});
diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js
index 78582a5350..3673749224 100644
--- a/test/parallel/test-internal-errors.js
+++ b/test/parallel/test-internal-errors.js
@@ -281,8 +281,18 @@ assert.strictEqual(
);
assert.strictEqual(
- errors.message('ERR_VALUE_OUT_OF_RANGE', ['A', 'some values', 'B']),
- 'The value of "A" must be some values. Received "B"'
+ errors.message('ERR_OUT_OF_RANGE', ['A']),
+ 'The value of "A" is out of range.'
+);
+
+assert.strictEqual(
+ errors.message('ERR_OUT_OF_RANGE', ['A', 'some values']),
+ 'The value of "A" is out of range. It must be some values.'
+);
+
+assert.strictEqual(
+ errors.message('ERR_OUT_OF_RANGE', ['A', 'some values', 'B']),
+ 'The value of "A" is out of range. It must be some values. Received B'
);
assert.strictEqual(
diff --git a/test/parallel/test-timers-enroll-invalid-msecs.js b/test/parallel/test-timers-enroll-invalid-msecs.js
index df6ad04069..384ab0ab25 100644
--- a/test/parallel/test-timers-enroll-invalid-msecs.js
+++ b/test/parallel/test-timers-enroll-invalid-msecs.js
@@ -27,10 +27,11 @@ const timers = require('timers');
common.expectsError(
() => timers.enroll({}, val),
{
- code: 'ERR_VALUE_OUT_OF_RANGE',
+ code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: 'The value of "msecs" must be a non-negative ' +
- `finite number. Received "${val}"`
+ message: 'The value of "msecs" is out of range. ' +
+ 'It must be a non-negative finite number. ' +
+ `Received ${val}`
}
);
});