fix(BaseClient): do not append default options if provided is not an object (#6453)

This commit is contained in:
J-Human
2022-01-09 18:49:03 +08:00
committed by GitHub
parent caaef53dd9
commit b92a7d7233

View File

@@ -1,6 +1,7 @@
'use strict'; 'use strict';
const EventEmitter = require('node:events'); const EventEmitter = require('node:events');
const { TypeError } = require('../errors');
const RESTManager = require('../rest/RESTManager'); const RESTManager = require('../rest/RESTManager');
const Options = require('../util/Options'); const Options = require('../util/Options');
const Util = require('../util/Util'); const Util = require('../util/Util');
@@ -13,6 +14,10 @@ class BaseClient extends EventEmitter {
constructor(options = {}) { constructor(options = {}) {
super(); super();
if (typeof options !== 'object' || options === null) {
throw new TypeError('INVALID_TYPE', 'options', 'object', true);
}
/** /**
* The options the client was instantiated with * The options the client was instantiated with
* @type {ClientOptions} * @type {ClientOptions}