Skip to content
Prev Previous commit
Next Next commit
errors: update internal/next_tick.js to use internals/errors
  • Loading branch information
jasnell committed Oct 25, 2016
commit 5ae2086ccd65829c4c882bd37a319dcc06af778c
1 change: 1 addition & 0 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function E(sym, val) {

// Note: Please try to keep these in alphabetical order
E('ASSERTION_ERROR', (msg) => msg);
E('INVALID_CALLBACK', 'callback is not a function');
E('INVALID_PORT', 'port must be a number >= 0 and <= 65535');
E('NATIVE_MODULE_NOT_FOUND', (module) => `No such native module ${module}`);
E('NO_CRYPTO', 'Node.js is not compiled with openssl crypto support');
Expand Down
6 changes: 4 additions & 2 deletions lib/internal/process/next_tick.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ function setupNextTick() {
}

function nextTick(callback) {
if (typeof callback !== 'function')
throw new TypeError('callback is not a function');
if (typeof callback !== 'function') {
const errors = require('internal/errors');
throw new errors.TypeError('INVALID_CALLBACK');
}
// on the way out, don't bother. it won't get fired anyway.
if (process._exiting)
return;
Expand Down