BaseClient: pass captureRejections option (#7288)

This commit is contained in:
Khafra
2022-01-18 05:21:05 -05:00
committed by GitHub
parent 9181a31e0b
commit 307389a335
2 changed files with 4 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ const Util = require('../util/Util');
*/
class BaseClient extends EventEmitter {
constructor(options = {}) {
super();
super({ captureRejections: true });
if (typeof options !== 'object' || options === null) {
throw new TypeError('INVALID_TYPE', 'options', 'object', true);

View File

@@ -210,6 +210,9 @@ class ShardClientUtil {
error.stack = err.stack;
/**
* Emitted when the client encounters an error.
* <warn>Errors thrown within this event do not have a catch handler, it is
* recommended to not use async functions as `error` event handlers. See the
* [Node.js docs](https://nodejs.org/api/events.html#capture-rejections-of-promises) for details.</warn>
* @event Client#error
* @param {Error} error The error encountered
*/