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-dgram-setTTL.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-dgram-setTTL.js')
-rw-r--r-- | test/parallel/test-dgram-setTTL.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/parallel/test-dgram-setTTL.js b/test/parallel/test-dgram-setTTL.js index c6e8cb3c66..36af63de10 100644 --- a/test/parallel/test-dgram-setTTL.js +++ b/test/parallel/test-dgram-setTTL.js @@ -14,7 +14,8 @@ socket.on('listening', common.mustCall(() => { }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, - message: 'The "ttl" argument must be of type number. Received type string' + message: 'The "ttl" argument must be of type number. Received type string' + + " ('foo')" }); // TTL must be a number from > 0 to < 256 |