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: nodejs#22436
Refs: nodejs#20253
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
BridgeAR authored and targos committed Sep 23, 2018
1 parent b1ffda6 commit e16dd6d
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 e16dd6d

Please sign in to comment.