diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-02-27 14:55:32 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-03-05 19:51:30 +0100 |
commit | 1e8d110e640c658e4f6ed7540db62d063269ba6c (patch) | |
tree | afe2636b1b190fee00006beaa484fa77d5949770 /lib/url.js | |
parent | 023f49c5a938ef631260b76876155eaf957084be (diff) | |
download | android-node-v8-1e8d110e640c658e4f6ed7540db62d063269ba6c.tar.gz android-node-v8-1e8d110e640c658e4f6ed7540db62d063269ba6c.tar.bz2 android-node-v8-1e8d110e640c658e4f6ed7540db62d063269ba6c.zip |
lib: port errors to new system
This is a first batch of updates that touches non-underscored modules in
lib.
PR-URL: https://github.com/nodejs/node/pull/19034
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/url.js')
-rw-r--r-- | lib/url.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/url.js b/lib/url.js index ab4b2b4647..bb6637809a 100644 --- a/lib/url.js +++ b/lib/url.js @@ -26,7 +26,9 @@ const { toASCII } = process.binding('config').hasIntl ? const { hexTable } = require('internal/querystring'); -const errors = require('internal/errors'); +const { + ERR_INVALID_ARG_TYPE +} = require('internal/errors').codes; const { spliceOne } = require('internal/util'); @@ -103,7 +105,7 @@ function urlParse(url, parseQueryString, slashesDenoteHost) { Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { if (typeof url !== 'string') { - throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'url', 'string', url); + throw new ERR_INVALID_ARG_TYPE('url', 'string', url); } // Copy chrome, IE, opera backslash-handling behavior. @@ -493,8 +495,8 @@ function urlFormat(urlObject, options) { if (typeof urlObject === 'string') { urlObject = urlParse(urlObject); } else if (typeof urlObject !== 'object' || urlObject === null) { - throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'urlObject', - ['Object', 'string'], urlObject); + throw new ERR_INVALID_ARG_TYPE('urlObject', + ['Object', 'string'], urlObject); } else if (!(urlObject instanceof Url)) { var format = urlObject[formatSymbol]; return format ? |