fix(Message): use Promise#reject instead of Throw on Message#delete (#4818)

This commit is contained in:
Ryan Munro
2020-09-16 02:35:54 +10:00
committed by GitHub
parent 8fa3a89482
commit 1e63f3756e

View File

@@ -550,7 +550,7 @@ class Message extends Base {
* .catch(console.error);
*/
delete(options = {}) {
if (typeof options !== 'object') throw new TypeError('INVALID_TYPE', 'options', 'object', true);
if (typeof options !== 'object') return Promise.reject(new TypeError('INVALID_TYPE', 'options', 'object', true));
const { timeout = 0, reason } = options;
if (timeout <= 0) {
return this.channel.messages.delete(this.id, reason).then(() => this);