diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-09-23 08:17:25 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-12-20 03:10:13 +0100 |
commit | ac2fc0dd5f5830d32dd89fe1c9c55d672cf59c0a (patch) | |
tree | 36d2e1a22d86269244d244f69acf4b46c42ea818 /test/parallel/test-string-decoder.js | |
parent | fc28761d771e676c57be92c99ab4e04f749c53f4 (diff) | |
download | node-new-ac2fc0dd5f5830d32dd89fe1c9c55d672cf59c0a.tar.gz |
errors: improve ERR_INVALID_ARG_TYPE
ERR_INVALID_ARG_TYPE is the most common error used throughout the
code base. This improves the error message by providing more details
to the user and by indicating more precisely which values are allowed
ones and which ones are not.
It adds the actual input to the error message in case it's a primitive.
If it's a class instance, it'll print the class name instead of
"object" and "falsy" or similar entries are not named "type" anymore.
PR-URL: https://github.com/nodejs/node/pull/29675
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-string-decoder.js')
-rw-r--r-- | test/parallel/test-string-decoder.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js index aaffa131cd..77c7736be9 100644 --- a/test/parallel/test-string-decoder.js +++ b/test/parallel/test-string-decoder.js @@ -196,8 +196,8 @@ common.expectsError( { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, - message: 'The "buf" argument must be one of type Buffer, TypedArray,' + - ' or DataView. Received type object' + message: 'The "buf" argument must be an instance of Buffer, TypedArray,' + + ' or DataView. Received null' } ); |