Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit ab45b62

Browse files
author
Jan Krems
committed
refactor: Remove single-use functions
1 parent be34a39 commit ab45b62

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

lib/_inspect.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ scripts List application scripts that are currently loaded
7474
scripts(true) List all scripts (including node-internals)
7575
`.trim();
7676

77-
function throwUnexpectedError(error) {
78-
process.nextTick(() => { throw error; });
79-
}
80-
81-
function delay(ms) {
82-
return new Promise((resolve) => setTimeout(resolve, ms));
83-
}
84-
8577
const ProtocolClient = (function setupClient() {
8678
const kOpCodeText = 0x1;
8779
const kOpCodeClose = 0x8;
@@ -1356,7 +1348,7 @@ class NodeInspector {
13561348
});
13571349
this.paused = false;
13581350
})
1359-
.then(null, throwUnexpectedError);
1351+
.then(null, (error) => process.nextTick(() => { throw error; }));
13601352
}
13611353

13621354
suspendReplWhile(fn) {
@@ -1370,7 +1362,7 @@ class NodeInspector {
13701362
this.repl.rli.resume();
13711363
this.repl.displayPrompt();
13721364
this.stdin.resume();
1373-
}).then(null, throwUnexpectedError);
1365+
}).then(null, (error) => process.nextTick(() => { throw error; }));
13741366
}
13751367

13761368
killChild() {
@@ -1401,7 +1393,8 @@ class NodeInspector {
14011393
this.stdout.write(' failed to connect, please retry\n');
14021394
process.exit(1);
14031395
}
1404-
return delay(500).then(() => attemptConnect());
1396+
1397+
return new Promise((resolve) => setTimeout(resolve, 500)).then(attemptConnect);
14051398
});
14061399
};
14071400

0 commit comments

Comments
 (0)