Skip to content

Commit afb4d55

Browse files
davidmarkclementsjasnell
authored andcommitted
errors: alter ERR_INVALID_DOMAIN_NAME
Changes the base instance for ERR_INVALID_DOMAIN_NAME from Error to TypeError as a more accurate representation of the error. PR-URL: #19961 Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 12bad69 commit afb4d55

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/internal/errors.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,9 +878,7 @@ E('ERR_INVALID_CHAR', invalidChar, TypeError);
878878
// This should probably be a `TypeError`.
879879
E('ERR_INVALID_CURSOR_POS',
880880
'Cannot set cursor row without setting its column', Error);
881-
882-
// This should probably be a `TypeError`.
883-
E('ERR_INVALID_DOMAIN_NAME', 'Unable to determine the domain name', Error);
881+
E('ERR_INVALID_DOMAIN_NAME', 'Unable to determine the domain name', TypeError);
884882
E('ERR_INVALID_FD',
885883
'"fd" must be a positive integer: %s', RangeError);
886884
E('ERR_INVALID_FD_TYPE', 'Unsupported fd type: %s', TypeError);

test/parallel/test-http-invalid-urls.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ function test(host) {
1919
`${module}.${fn} should not connect to ${host}`
2020
);
2121
const throws = () => { modules[module][fn](host, doNotCall); };
22-
common.expectsError(throws, { code: 'ERR_INVALID_DOMAIN_NAME' });
22+
common.expectsError(throws, {
23+
type: TypeError,
24+
code: 'ERR_INVALID_DOMAIN_NAME'
25+
});
2326
});
2427
});
2528
}

0 commit comments

Comments
 (0)