Skip to content

Commit

Permalink
repl: refactor ERR_SCRIPT_EXECUTION_INTERRUPTED stack handling
Browse files Browse the repository at this point in the history
The stack was removed later on instead of never being attached in
the first place.

PR-URL: #22436
Refs: #20253
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
BridgeAR committed Aug 27, 2018
1 parent ccb303e commit 2eef077
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,6 @@ function REPLServer(prompt,
} catch (e) {
err = e;

if (err && err.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED') {
// The stack trace for this case is not very useful anyway.
Object.defineProperty(err, 'stack', { value: '' });
}

if (process.domain) {
debug('not recoverable, send to domain');
process.domain.emit('error', err);
Expand All @@ -365,7 +360,11 @@ function REPLServer(prompt,
if (self.breakEvalOnSigint) {
const interrupt = new Promise((resolve, reject) => {
sigintListener = () => {
reject(new ERR_SCRIPT_EXECUTION_INTERRUPTED());
const tmp = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
const err = new ERR_SCRIPT_EXECUTION_INTERRUPTED();
Error.stackTraceLimit = tmp;
reject(err);
};
prioritizedSigintQueue.add(sigintListener);
});
Expand All @@ -384,11 +383,6 @@ function REPLServer(prompt,
// Remove prioritized SIGINT listener if it was not called.
prioritizedSigintQueue.delete(sigintListener);

if (err.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED') {
// The stack trace for this case is not very useful anyway.
Object.defineProperty(err, 'stack', { value: '' });
}

unpause();
if (err && process.domain) {
debug('not recoverable, send to domain');
Expand Down

0 comments on commit 2eef077

Please sign in to comment.