mirror of
https://github.com/danbulant/discord.js
synced 2026-06-23 16:52:14 +00:00
fix(Collector): throw an error if a non-function was provided as filter (#5034)
This commit is contained in:
parent
09d07553ab
commit
7365f40300
1 changed files with 5 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const { TypeError } = require('../../errors');
|
||||
const Collection = require('../../util/Collection');
|
||||
const Util = require('../../util/Util');
|
||||
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue