Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2021-06-13 15:53:05 +0300
committerDanielle Adams <adamzdanielle@gmail.com>2021-06-21 18:08:07 +0300
commit1e8bdab58143c68bbbabbf083228caf0ac456d3b (patch)
tree927425f9406f72832185498788336067d746868d /lib
parent3d7892ef390e8404d09061ccc23789ced53baa97 (diff)
debugger: use ERR_DEBUGGER_STARTUP_ERROR in _inspect.js
PR-URL: https://github.com/nodejs/node/pull/39024 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/inspector/_inspect.js12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/internal/inspector/_inspect.js b/lib/internal/inspector/_inspect.js
index 204e037064d..e2309fcc68c 100644
--- a/lib/internal/inspector/_inspect.js
+++ b/lib/internal/inspector/_inspect.js
@@ -8,7 +8,6 @@ const {
ArrayPrototypePop,
ArrayPrototypeShift,
ArrayPrototypeSlice,
- Error,
FunctionPrototypeBind,
Number,
Promise,
@@ -46,12 +45,7 @@ const { 0: InspectClient, 1: createRepl } =
const debuglog = util.debuglog('inspect');
-class StartupError extends Error {
- constructor(message) {
- super(message);
- this.name = 'StartupError';
- }
-}
+const { ERR_DEBUGGER_STARTUP_ERROR } = require('internal/errors').codes;
async function portIsFree(host, port, timeout = 9999) {
if (port === 0) return; // Binding to a random port.
@@ -66,7 +60,7 @@ async function portIsFree(host, port, timeout = 9999) {
while (true) {
await asyncIterator.next();
if (signal.aborted) {
- throw new StartupError( // eslint-disable-line no-restricted-syntax
+ throw new ERR_DEBUGGER_STARTUP_ERROR(
`Timeout (${timeout}) waiting for ${host}:${port} to be free`);
}
const error = await new Promise((resolve) => {
@@ -342,7 +336,7 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2),
stdin.resume();
function handleUnexpectedError(e) {
- if (!(e instanceof StartupError)) {
+ if (e.code !== 'ERR_DEBUGGER_STARTUP_ERROR') {
console.error('There was an internal error in Node.js. ' +
'Please report this bug.');
console.error(e.message);