| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9b993ed commit b7ee9d8
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,6 @@ const { | |||
| 8 | 8 | ArrayPrototypePop, | |
| 9 | 9 | ArrayPrototypeShift, | |
| 10 | 10 | ArrayPrototypeSlice, | |
| 11 | - Error, | ||
| 12 | 11 | FunctionPrototypeBind, | |
| 13 | 12 | Number, | |
| 14 | 13 | Promise, | |
@@ -50,12 +49,7 @@ const { 0: InspectClient, 1: createRepl } = | |||
| 50 | 49 | ||
| 51 | 50 | const debuglog = util.debuglog('inspect'); | |
| 52 | 51 | ||
| 53 | - class StartupError extends Error { | ||
| 54 | - constructor(message) { | ||
| 55 | - super(message); | ||
| 56 | - this.name = 'StartupError'; | ||
| 57 | - } | ||
| 58 | - } | ||
| 52 | + const { ERR_DEBUGGER_STARTUP_ERROR } = require('internal/errors').codes; | ||
| 59 | 53 | ||
| 60 | 54 | async function portIsFree(host, port, timeout = 9999) { | |
| 61 | 55 | if (port === 0) return; // Binding to a random port. | |
@@ -70,7 +64,7 @@ async function portIsFree(host, port, timeout = 9999) { | |||
| 70 | 64 | while (true) { | |
| 71 | 65 | await asyncIterator.next(); | |
| 72 | 66 | if (signal.aborted) { | |
| 73 | - throw new StartupError( // eslint-disable-line no-restricted-syntax | ||
| 67 | + throw new ERR_DEBUGGER_STARTUP_ERROR( | ||
| 74 | 68 | `Timeout (${timeout}) waiting for ${host}:${port} to be free`); | |
| 75 | 69 | } | |
| 76 | 70 | const error = await new Promise((resolve) => { | |
@@ -346,7 +340,7 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2), | |||
| 346 | 340 | stdin.resume(); | |
| 347 | 341 | ||
| 348 | 342 | function handleUnexpectedError(e) { | |
| 349 | - if (!(e instanceof StartupError)) { | ||
| 343 | + if (e.code !== 'ERR_DEBUGGER_STARTUP_ERROR') { | ||
| 350 | 344 | console.error('There was an internal error in Node.js. ' + | |
| 351 | 345 | 'Please report this bug.'); | |
| 352 | 346 | console.error(e.message); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments