Skip to content

Commit

Permalink
fix(Collector): throw an error if a non-function was provided as filt…
Browse files Browse the repository at this point in the history
…er (#5034)
  • Loading branch information
SpaceEEC committed Dec 8, 2020
1 parent 09d0755 commit 7365f40
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/structures/interfaces/Collector.js
@@ -1,6 +1,7 @@
'use strict';

const EventEmitter = require('events');
const { TypeError } = require('../../errors');
const Collection = require('../../util/Collection');
const Util = require('../../util/Util');

Expand Down Expand Up @@ -74,6 +75,10 @@ class Collector extends EventEmitter {
*/
this._idletimeout = null;

if (typeof filter !== 'function') {
throw new TypeError('INVALID_TYPE', 'filter', 'function');
}

this.handleCollect = this.handleCollect.bind(this);
this.handleDispose = this.handleDispose.bind(this);

Expand Down

0 comments on commit 7365f40

Please sign in to comment.