summaryrefslogtreecommitdiff
path: root/lib/internal/timers.js
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-03-04 22:16:24 +0100
committerMichaël Zasso <targos@protonmail.com>2018-03-07 14:54:38 +0100
commit1d2fd8b65bacaf4401450edc8ed529106cbcfc67 (patch)
treedd6230e888c69ef3dc1b19de1ea8f9de7a81fd63 /lib/internal/timers.js
parentcb5f9a6d871f6b2e0da8fa72dc2e91fb37ef9713 (diff)
downloadandroid-node-v8-1d2fd8b65bacaf4401450edc8ed529106cbcfc67.tar.gz
android-node-v8-1d2fd8b65bacaf4401450edc8ed529106cbcfc67.tar.bz2
android-node-v8-1d2fd8b65bacaf4401450edc8ed529106cbcfc67.zip
lib: port remaining errors to new system
PR-URL: https://github.com/nodejs/node/pull/19137 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/internal/timers.js')
-rw-r--r--lib/internal/timers.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/internal/timers.js b/lib/internal/timers.js
index 8c1a87a65f..26fc3f941b 100644
--- a/lib/internal/timers.js
+++ b/lib/internal/timers.js
@@ -10,7 +10,11 @@ const {
const async_id_symbol = Symbol('asyncId');
const trigger_async_id_symbol = Symbol('triggerId');
-const errors = require('internal/errors');
+const {
+ ERR_INVALID_ARG_TYPE,
+ ERR_INVALID_CALLBACK,
+ ERR_OUT_OF_RANGE
+} = require('internal/errors').codes;
// Timeout values > TIMEOUT_MAX are set to 1.
const TIMEOUT_MAX = 2 ** 31 - 1;
@@ -94,7 +98,7 @@ Timeout.prototype[refreshFnSymbol] = function refresh() {
function setUnrefTimeout(callback, after, arg1, arg2, arg3) {
// Type checking identical to setTimeout()
if (typeof callback !== 'function') {
- throw new errors.TypeError('ERR_INVALID_CALLBACK');
+ throw new ERR_INVALID_CALLBACK();
}
let i, args;
@@ -127,13 +131,11 @@ function setUnrefTimeout(callback, after, arg1, arg2, arg3) {
// Type checking used by timers.enroll() and Socket#setTimeout()
function validateTimerDuration(msecs) {
if (typeof msecs !== 'number') {
- throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'msecs',
- 'number', msecs);
+ throw new ERR_INVALID_ARG_TYPE('msecs', 'number', msecs);
}
if (msecs < 0 || !isFinite(msecs)) {
- throw new errors.RangeError('ERR_OUT_OF_RANGE', 'msecs',
- 'a non-negative finite number', msecs);
+ throw new ERR_OUT_OF_RANGE('msecs', 'a non-negative finite number', msecs);
}
// Ensure that msecs fits into signed int32