Skip to content

Commit

Permalink
fix(Collector): throw an error if a non-function was provided as filter
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceEEC committed Nov 22, 2020
1 parent 1f4b9fe commit d70af1f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/structures/interfaces/Collector.js
Original file line number Diff line number Diff line change
@@ -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 d70af1f

Please sign in to comment.