summaryrefslogtreecommitdiff
path: root/lib/internal/repl.js
diff options
context:
space:
mode:
authorsreepurnajasti <jsreepur@in.ibm.com>2017-05-30 10:16:39 -0400
committerJames M Snell <jasnell@gmail.com>2017-06-01 20:04:55 -0700
commit28227963faa72e623ae97707988a9aa940d01958 (patch)
tree5631be1a8491c4800237c43900d003c6e05f7bb9 /lib/internal/repl.js
parent3c989de2074a1bc103be0dafb5b11c87bbba8351 (diff)
downloadnode-new-28227963faa72e623ae97707988a9aa940d01958.tar.gz
errors,repl: migrate to use internal/errors.js
PR-URL: https://github.com/nodejs/node/pull/13299 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/repl.js')
-rw-r--r--lib/internal/repl.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/internal/repl.js b/lib/internal/repl.js
index 4c27fa2746..ee2a1544de 100644
--- a/lib/internal/repl.js
+++ b/lib/internal/repl.js
@@ -7,6 +7,7 @@ const fs = require('fs');
const os = require('os');
const util = require('util');
const debug = util.debuglog('repl');
+const errors = require('internal/errors');
module.exports = Object.create(REPL);
module.exports.createInternalRepl = createRepl;
@@ -153,13 +154,14 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) {
if (oldReplJSONHistory) repl.history = JSON.parse(oldReplJSONHistory);
if (!Array.isArray(repl.history)) {
- throw new Error('Expected array, got ' + typeof repl.history);
+ throw new errors.TypeError('ERR_INVALID_ARG_TYPE',
+ typeof repl.history, 'Array');
}
repl.history = repl.history.slice(0, repl.historySize);
} catch (err) {
if (err.code !== 'ENOENT') {
return ready(
- new Error(`Could not parse history data in ${oldHistoryPath}.`));
+ new errors.Error('ERR_PARSE_HISTORY_DATA', oldHistoryPath));
}
}
}