summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkysnm <tokyoincidents.g@gmail.com>2017-12-17 20:29:35 +0900
committerJon Moss <me@jonathanmoss.me>2017-12-22 13:27:25 -0500
commitab5a2aba38c7de995d7bb56750ab90c0c7849157 (patch)
treee293165631c5293fe6c1100c0bbd72edb52f648e /lib
parent0b0a4fc8ecdab89074630bd814f26780a4cf9eda (diff)
downloadandroid-node-v8-ab5a2aba38c7de995d7bb56750ab90c0c7849157.tar.gz
android-node-v8-ab5a2aba38c7de995d7bb56750ab90c0c7849157.tar.bz2
android-node-v8-ab5a2aba38c7de995d7bb56750ab90c0c7849157.zip
repl: migrate errors to internal/errors
PR-URL: https://github.com/nodejs/node/pull/17716 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/errors.js2
-rw-r--r--lib/repl.js6
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
index 7276bb6344..5b18a7026e 100644
--- a/lib/internal/errors.js
+++ b/lib/internal/errors.js
@@ -445,6 +445,8 @@ E('ERR_OUTOFMEMORY', 'Out of memory');
E('ERR_OUT_OF_RANGE', 'The "%s" argument is out of range');
E('ERR_PARSE_HISTORY_DATA', 'Could not parse history data in %s');
E('ERR_REQUIRE_ESM', 'Must use import to load ES Module: %s');
+E('ERR_SCRIPT_EXECUTION_INTERRUPTED',
+ 'Script execution was interrupted by `SIGINT`.');
E('ERR_SERVER_ALREADY_LISTEN',
'Listen method has been called more than once without closing.');
E('ERR_SOCKET_ALREADY_BOUND', 'Socket is already bound');
diff --git a/lib/repl.js b/lib/repl.js
index 0378a6664c..98fd78eaca 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -319,7 +319,7 @@ function REPLServer(prompt,
} catch (e) {
err = e;
- if (err && err.message === 'Script execution interrupted.') {
+ if (err && err.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED') {
// The stack trace for this case is not very useful anyway.
Object.defineProperty(err, 'stack', { value: '' });
}
@@ -339,7 +339,7 @@ function REPLServer(prompt,
if (self.breakEvalOnSigint) {
const interrupt = new Promise((resolve, reject) => {
sigintListener = () => {
- reject(new Error('Script execution interrupted.'));
+ reject(new errors.Error('ERR_SCRIPT_EXECUTION_INTERRUPTED'));
};
prioritizedSigintQueue.add(sigintListener);
});
@@ -358,7 +358,7 @@ function REPLServer(prompt,
// Remove prioritized SIGINT listener if it was not called.
prioritizedSigintQueue.delete(sigintListener);
- if (err.message === 'Script execution interrupted.') {
+ if (err.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED') {
// The stack trace for this case is not very useful anyway.
Object.defineProperty(err, 'stack', { value: '' });
}