https: convert to using internal/errors
PR-URL: https://github.com/nodejs/node/pull/15603 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
This commit is contained in:
parent
f30820fdca
commit
4843c2f415
@ -30,6 +30,7 @@ const util = require('util');
|
|||||||
const inherits = util.inherits;
|
const inherits = util.inherits;
|
||||||
const debug = util.debuglog('https');
|
const debug = util.debuglog('https');
|
||||||
const { urlToOptions, searchParamsSymbol } = require('internal/url');
|
const { urlToOptions, searchParamsSymbol } = require('internal/url');
|
||||||
|
const errors = require('internal/errors');
|
||||||
|
|
||||||
function Server(opts, requestListener) {
|
function Server(opts, requestListener) {
|
||||||
if (!(this instanceof Server)) return new Server(opts, requestListener);
|
if (!(this instanceof Server)) return new Server(opts, requestListener);
|
||||||
@ -226,7 +227,7 @@ exports.request = function request(options, cb) {
|
|||||||
if (typeof options === 'string') {
|
if (typeof options === 'string') {
|
||||||
options = url.parse(options);
|
options = url.parse(options);
|
||||||
if (!options.hostname) {
|
if (!options.hostname) {
|
||||||
throw new Error('Unable to determine the domain name');
|
throw new errors.Error('ERR_INVALID_DOMAIN_NAME');
|
||||||
}
|
}
|
||||||
} else if (options && options[searchParamsSymbol] &&
|
} else if (options && options[searchParamsSymbol] &&
|
||||||
options[searchParamsSymbol][searchParamsSymbol]) {
|
options[searchParamsSymbol][searchParamsSymbol]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user