summaryrefslogtreecommitdiff
path: root/lib/events.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events.js')
-rw-r--r--lib/events.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/events.js b/lib/events.js
index 28a8c4228b..9ad5ec376f 100644
--- a/lib/events.js
+++ b/lib/events.js
@@ -56,7 +56,10 @@ Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
// greater and not a NaN).
if (typeof arg !== 'number' || arg < 0 || arg !== arg) {
const errors = lazyErrors();
- throw new errors.TypeError('ERR_OUT_OF_RANGE', 'defaultMaxListeners');
+ throw new errors.RangeError('ERR_OUT_OF_RANGE',
+ 'defaultMaxListeners',
+ 'a non-negative number',
+ arg);
}
defaultMaxListeners = arg;
}
@@ -78,7 +81,8 @@ EventEmitter.init = function() {
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
if (typeof n !== 'number' || n < 0 || isNaN(n)) {
const errors = lazyErrors();
- throw new errors.TypeError('ERR_OUT_OF_RANGE', 'n');
+ throw new errors.RangeError('ERR_OUT_OF_RANGE', 'n',
+ 'a non-negative number', n);
}
this._maxListeners = n;
return this;