diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-18 15:41:19 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-21 22:52:08 +0100 |
commit | 39f4158bc38ff2925b86563082c8d26ab3d20b17 (patch) | |
tree | 9e1a669fd41379bcd9b85bdf0e17fde5033a2c77 /lib/internal/url.js | |
parent | df0870dddf15ab5396ab9842fdbe4c06a8186cda (diff) | |
download | android-node-v8-39f4158bc38ff2925b86563082c8d26ab3d20b17.tar.gz android-node-v8-39f4158bc38ff2925b86563082c8d26ab3d20b17.tar.bz2 android-node-v8-39f4158bc38ff2925b86563082c8d26ab3d20b17.zip |
lib: move extra properties into error creation
This encapsulates the Node.js errors more by adding extra properties
to an error inside of the function to create the error message instead
of adding the properties at the call site. That simplifies the usage
of our errors and makes sure the expected properties are always set.
PR-URL: https://github.com/nodejs/node/pull/26752
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/url.js')
-rw-r--r-- | lib/internal/url.js | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/internal/url.js b/lib/internal/url.js index 08ae050b95..17af756668 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -238,9 +238,7 @@ function onParseComplete(flags, protocol, username, password, } function onParseError(flags, input) { - const error = new ERR_INVALID_URL(input); - error.input = input; - throw error; + throw new ERR_INVALID_URL(input); } function onParseProtocolComplete(flags, protocol, username, password, |