Ruben Bridgewater
1698c8e165
errors: fix and improve error types
...
1) Add missing lazy assert call
2) Remove obsolete error type
3) Name undocumented error type more appropriate
4) Consolidate error type style (rely on util.format
instead of using a function)
5) Uppercase the first letter from error messages
6) Improve some internal error parameters
PR-URL: https://github.com/nodejs/node/pull/13857
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-06-28 20:00:25 +02:00
Ruben Bridgewater
0401754b92
errors: prevent stack recalculation
...
Newer v8 versions exclude the constructor from the stack trace
so the recalculation of the trace can be avoided.
PR-URL: https://github.com/nodejs/node/pull/13743
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-06-22 14:13:06 -04:00
Ruben Bridgewater
3e178848a5
errors: improve ERR_INVALID_ARG_TYPE
...
The error message might be misleading if an object property
was the issue and not the argument itself.
Fix this by checking if a argument or a property is passed
to the handler function.
PR-URL: https://github.com/nodejs/node/pull/13730
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-06-22 13:54:53 -04:00
Tobias Nießen
a0f7284346
errors,process: fix error message of hrtime()
...
process.hrtime() incorrectly passed the function name to
errors.TypeError instead of the name of the argument.
Additionally, the type of the actual argument was added to the error
message and a new error code ERR_INVALID_ARRAY_LENGTH was added.
PR-URL: https://github.com/nodejs/node/pull/13739
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-06-20 19:43:01 +02:00
LAKSHMI SWETHA GOPIREDDY
d2913384aa
errors,stream_wrap: use internal/errors.js
...
PR-URL: https://github.com/nodejs/node/pull/13291
Refs: https://github.com/nodejs/node/issues/11273
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-06-20 19:11:02 +02:00
Sebastian Van Sande
de4a749788
internal/util: use internal/errors.js
...
PR-URL: https://github.com/nodejs/node/pull/11301
Refs: https://github.com/nodejs/node/issues/11273
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Franziska Hinkelmann <fhinkel@vt.edu >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-06-15 17:07:45 +02:00
sreepurnajasti
d50a802feb
errors,stream-transform: migrate to use internal/errors.js
...
PR-URL: https://github.com/nodejs/node/pull/13310
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-06-15 03:03:45 -04:00
Dan Homola
aff8d358fa
errors, repl: migrate to use internal/errors.js
...
* Use existing errors where suitable
* Assign code to a REPL specific error
* Include documentation for the new error code
PR-URL: https://github.com/nodejs/node/pull/11347
Ref: https://github.com/nodejs/node/issues/11273
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-06-14 23:05:25 +02:00
Artur G Vieira
80c9ef0b6b
http: edit _storeHeader to check for Trailer header
...
Test non-chunked message does not have trailer header set,
message will be terminated by the first empty line after the
header fields, regardless of the header fields present in the
message, and thus cannot contain a message body or 'trailers'.
PR-URL: https://github.com/nodejs/node/pull/12990
Ref: https://github.com/nodejs/node/issues/2842
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2017-06-13 13:06:39 -07:00
James M Snell
873e2f270f
errors: add missing ERR_ prefix on util.callbackify error
...
The `FALSY_VALUE_REJECTION` error code added by
https://github.com/nodejs/node/pull/12712 did not have the `ERR_` prefix,
nor was it added to the errors.md documentation. Add the prefix in for
consistency.
PR-URL: https://github.com/nodejs/node/pull/13604
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-06-13 12:33:52 -07:00
Scott McKenzie
7f3f72c19b
errors, readline: migrate to use internal/errors.js
...
PR-URL: https://github.com/nodejs/node/pull/11390
Ref: https://github.com/nodejs/node/issues/11273
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-06-13 08:44:22 -07:00
Refael Ackermann
af3aa682ac
util: add callbackify
...
Add `util.callbackify(function)` for creating callback style functions
from functions returning a `Thenable`
PR-URL: https://github.com/nodejs/node/pull/12712
Fixes: https://github.com/nodejs/CTC/issues/109
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-06-10 22:49:28 -04:00
Gautam Mittal
3630ed1c82
errors,tty: migrate to use internal/errors.js
...
PR-URL: https://github.com/nodejs/node/pull/13240
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-06-06 11:55:15 -04:00
sreepurnajasti
062071a9c3
errors,process: migrate to use internal/errors.js
...
PR-URL: https://github.com/nodejs/node/pull/13285
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2017-06-05 15:15:58 -04:00
Bidisha Pyne
a9f798ebcc
errors,http_server: migrate to use internal/errors.js
...
PR-URL: https://github.com/nodejs/node/pull/13301
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-06-01 20:09:30 -07:00
sreepurnajasti
28227963fa
errors,repl: migrate to use internal/errors.js
...
PR-URL: https://github.com/nodejs/node/pull/13299
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-06-01 20:04:55 -07:00
larissayvette
234353a1b8
lib,src: refactor buffer out of range index
...
PR-URL: https://github.com/nodejs/node/pull/11296
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2017-05-27 21:11:26 -07:00
mskec
0ecdf29340
errors: migrate lib/console
...
Migrate console.js to use internal/errors.js.
PR-URL: https://github.com/nodejs/node/pull/11340
Ref: https://github.com/nodejs/node/issues/11273
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2017-05-27 09:28:07 +02:00
Michael Dawson
e912c67d24
dgram: convert to using internal/errors
...
Covert lib/dgram.js over to using lib/internal/errors.js
for generating Errors. See
[using-internal-errors.md](https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md )
for more details.
I have not addressed the cases that use errnoException() and
exceptionWithHostPort() helper methods as changing these would require
fixing the tests across all of the different files that use them. In
addition, these helpers already add a `code` to the Error and we'll
have to discuss how that interacts with the `code` used by
lib/internal/errors.js. I believe we should convert all users
of errnoException and exceptionWithHostPort in a PR dedicated to
that conversion.
PR-URL: https://github.com/nodejs/node/pull/12926
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben.bridgewater@fintura.de >
2017-05-24 10:16:46 -04:00
Faiz Halde
425aba4f36
errors: AssertionError moved to internal/error
...
AssertionError class is moved to interna/error
in reference to the TODO in assert.js. This was
suggested to get rid of the cyclic dependency
between assert.js and internal/error.js
PR-URL: https://github.com/nodejs/node/pull/12906
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-05-23 07:43:53 -07:00
James M Snell
76327613af
errors, child_process: migrate to using internal/errors
...
PR-URL: https://github.com/nodejs/node/pull/11300
Ref: https://github.com/nodejs/node/issues/11273
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-04-27 15:44:14 -07:00
James M Snell
f0b702555a
errors: use lazy assert to avoid issues on startup
...
Use of assert must be lazy to allow errors to be used early
before the process is completely set up
PR-URL: https://github.com/nodejs/node/pull/11300
Ref: https://github.com/nodejs/node/issues/11273
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-04-27 15:44:08 -07:00
Timothy Gu
d457a986a0
url: port WHATWG URL API to internal/errors
...
Also slightly revises grammar.
PR-URL: https://github.com/nodejs/node/pull/12574
Refs: https://github.com/nodejs/node/issues/11273
Refs: https://github.com/nodejs/node/issues/11299
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2017-04-25 16:33:08 -07:00
James M Snell
251e5ed8ee
errors: assign error code to bootstrap_node created error
...
This does not use the internal/errors.js module because the error
in question may actually be *caused* by an attempt to load
internal/errors.js. This error should only be encountered in the
case of a bug within Node.js itself.
PR-URL: https://github.com/nodejs/node/pull/11298
Ref: https://github.com/nodejs/node/issues/11273
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2017-04-24 09:06:54 -07:00
James M Snell
e75bc87d22
errors: port internal/process errors to internal/errors
...
* Assign codes to the handful of errors reported by
internal/process/*.js
* Include documentation for the new error codes
* Improve error messages
* Improve test coverage for process.nextTick
PR-URL: https://github.com/nodejs/node/pull/11294
Ref: https://github.com/nodejs/node/issues/11273
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-04-20 11:34:07 -07:00
James M Snell
7b4a72d797
errors: add space between error name and code
...
`Error[CODE]` becomes `Error [CODE]`
PR-URL: https://github.com/nodejs/node/pull/12099
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-04-03 09:48:40 -07:00
DavidCai
a00c9e95e4
errors: remove needless lazyAssert
...
PR-URL: https://github.com/nodejs/node/pull/11891
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2017-03-21 23:29:03 -07:00
DavidCai
b5eccc4c7e
lib, test: add duplicate symbol checking in E()
...
Add duplicate symbol checking in E() to avoid potential confusing
result. Increase coverage of internal/errors.
PR-URL: https://github.com/nodejs/node/pull/11829
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2017-03-15 17:09:33 +01:00
James M Snell
159749d522
errors: add internal/errors.js
...
Add the internal/errors.js core mechanism.
PR-URL: https://github.com/nodejs/node/pull/11220
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-02-09 13:46:14 -08:00