diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-04-07 20:36:33 +0800 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-04-10 01:08:10 +0200 |
commit | 362694401fc08f1eb312417487bfc2d3c9281a6e (patch) | |
tree | 0922c3b51834356953d886141348bd180027a742 /test | |
parent | 5b8c62c60d63a0da00da20823ce6fed7039036a7 (diff) | |
download | android-node-v8-362694401fc08f1eb312417487bfc2d3c9281a6e.tar.gz android-node-v8-362694401fc08f1eb312417487bfc2d3c9281a6e.tar.bz2 android-node-v8-362694401fc08f1eb312417487bfc2d3c9281a6e.zip |
src: rename ERR_STRING_TOO_LARGE to ERR_STRING_TOO_LONG
The old error name and message were trying to be consistent with
ERR_BUFFER_TOO_LARGE but they were not really accurate.
The kStringMaxLength was measured in number of characters,
not number of bytes. The name ERR_STRING_TOO_LARGE also
seems a bit awkward. This patch tries to correct them before
they get released to users.
PR-URL: https://github.com/nodejs/node/pull/19864
Refs: https://github.com/nodejs/node/pull/19739
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'test')
7 files changed, 24 insertions, 17 deletions
diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js index 96a3273254..c7cf1319e7 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js @@ -28,7 +28,8 @@ const stringLengthHex = kStringMaxLength.toString(16); common.expectsError(function() { buf.toString('ascii'); }, { - message: `Cannot create a string larger than 0x${stringLengthHex} bytes`, - code: 'ERR_STRING_TOO_LARGE', + message: `Cannot create a string longer than 0x${stringLengthHex} ` + + 'characters', + code: 'ERR_STRING_TOO_LONG', type: Error }); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js index 90e13ce788..920124e897 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js @@ -28,7 +28,8 @@ const stringLengthHex = kStringMaxLength.toString(16); common.expectsError(function() { buf.toString('base64'); }, { - message: `Cannot create a string larger than 0x${stringLengthHex} bytes`, - code: 'ERR_STRING_TOO_LARGE', + message: `Cannot create a string longer than 0x${stringLengthHex} ` + + 'characters', + code: 'ERR_STRING_TOO_LONG', type: Error }); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js index 0ffd1eb416..f8aed7c0b2 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js @@ -29,8 +29,9 @@ const stringLengthHex = kStringMaxLength.toString(16); common.expectsError(function() { buf.toString('latin1'); }, { - message: `Cannot create a string larger than 0x${stringLengthHex} bytes`, - code: 'ERR_STRING_TOO_LARGE', + message: `Cannot create a string longer than 0x${stringLengthHex} ` + + 'characters', + code: 'ERR_STRING_TOO_LONG', type: Error }); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js index bc64ef396d..18fb46e0df 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js @@ -28,7 +28,8 @@ const stringLengthHex = kStringMaxLength.toString(16); common.expectsError(function() { buf.toString('hex'); }, { - message: `Cannot create a string larger than 0x${stringLengthHex} bytes`, - code: 'ERR_STRING_TOO_LARGE', + message: `Cannot create a string longer than 0x${stringLengthHex} ` + + 'characters', + code: 'ERR_STRING_TOO_LONG', type: Error }); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js index f6c9f21e4b..5f7221b591 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js @@ -32,8 +32,9 @@ assert.throws(function() { }, function(e) { if (e.message !== 'Array buffer allocation failed') { common.expectsError({ - message: `Cannot create a string larger than 0x${stringLengthHex} bytes`, - code: 'ERR_STRING_TOO_LARGE', + message: `Cannot create a string longer than 0x${stringLengthHex} ` + + 'characters', + code: 'ERR_STRING_TOO_LONG', type: Error })(e); return true; @@ -45,7 +46,8 @@ assert.throws(function() { common.expectsError(function() { buf.toString('utf8'); }, { - message: `Cannot create a string larger than 0x${stringLengthHex} bytes`, - code: 'ERR_STRING_TOO_LARGE', + message: `Cannot create a string longer than 0x${stringLengthHex} ` + + 'characters', + code: 'ERR_STRING_TOO_LONG', type: Error }); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js index e4b66d8f30..e46b5f24cc 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js @@ -29,7 +29,8 @@ const stringLengthHex = kStringMaxLength.toString(16); common.expectsError(function() { buf.toString('utf16le'); }, { - message: `Cannot create a string larger than 0x${stringLengthHex} bytes`, - code: 'ERR_STRING_TOO_LARGE', + message: `Cannot create a string longer than 0x${stringLengthHex} ` + + 'characters', + code: 'ERR_STRING_TOO_LONG', type: Error }); diff --git a/test/sequential/test-fs-readfile-tostring-fail.js b/test/sequential/test-fs-readfile-tostring-fail.js index f8b0c666a0..c5ed855910 100644 --- a/test/sequential/test-fs-readfile-tostring-fail.js +++ b/test/sequential/test-fs-readfile-tostring-fail.js @@ -35,9 +35,9 @@ stream.on('finish', common.mustCall(function() { if (err.message !== 'Array buffer allocation failed') { const stringLengthHex = kStringMaxLength.toString(16); common.expectsError({ - message: 'Cannot create a string larger than ' + - `0x${stringLengthHex} bytes`, - code: 'ERR_STRING_TOO_LARGE', + message: 'Cannot create a string longer than ' + + `0x${stringLengthHex} characters`, + code: 'ERR_STRING_TOO_LONG', type: Error })(err); } |