From 1e8d110e640c658e4f6ed7540db62d063269ba6c Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Tue, 27 Feb 2018 14:55:32 +0100 Subject: lib: port errors to new system This is a first batch of updates that touches non-underscored modules in lib. PR-URL: https://github.com/nodejs/node/pull/19034 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Joyee Cheung --- lib/timers.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/timers.js') diff --git a/lib/timers.js b/lib/timers.js index 2744f231b5..32f6ccb00c 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -37,7 +37,7 @@ const internalUtil = require('internal/util'); const { createPromise, promiseResolve } = process.binding('util'); const assert = require('assert'); const util = require('util'); -const errors = require('internal/errors'); +const { ERR_INVALID_CALLBACK } = require('internal/errors').codes; const debug = util.debuglog('timer'); const { destroyHooksExist, @@ -375,7 +375,7 @@ exports.enroll = util.deprecate(enroll, function setTimeout(callback, after, arg1, arg2, arg3) { if (typeof callback !== 'function') { - throw new errors.TypeError('ERR_INVALID_CALLBACK'); + throw new ERR_INVALID_CALLBACK(); } var i, args; @@ -466,7 +466,7 @@ const clearTimeout = exports.clearTimeout = function(timer) { exports.setInterval = function(callback, repeat, arg1, arg2, arg3) { if (typeof callback !== 'function') { - throw new errors.TypeError('ERR_INVALID_CALLBACK'); + throw new ERR_INVALID_CALLBACK(); } var i, args; @@ -739,7 +739,7 @@ const Immediate = class Immediate { function setImmediate(callback, arg1, arg2, arg3) { if (typeof callback !== 'function') { - throw new errors.TypeError('ERR_INVALID_CALLBACK'); + throw new ERR_INVALID_CALLBACK(); } var i, args; -- cgit v1.2.3