repl: refactor ERR_SCRIPT_EXECUTION_INTERRUPTED stack handling
The stack was removed later on instead of never being attached in the first place. PR-URL: https://github.com/nodejs/node/pull/22436 Refs: https://github.com/nodejs/node/issues/20253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
ccb303e037
commit
2eef077834
16
lib/repl.js
16
lib/repl.js
@ -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);
|
||||
@ -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);
|
||||
});
|
||||
@ -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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user