Skip to content

Commit

Permalink
fix(*): add missing imports for custom errors (#5767)
Browse files Browse the repository at this point in the history
  • Loading branch information
iShibi committed Jun 7, 2021
1 parent d1c5b6f commit e980948
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/client/websocket/WebSocketManager.js
Expand Up @@ -3,7 +3,7 @@
const EventEmitter = require('events');
const WebSocketShard = require('./WebSocketShard');
const PacketHandlers = require('./handlers');
const { Error: DJSError } = require('../../errors');
const { Error } = require('../../errors');
const Collection = require('../../util/Collection');
const { Events, ShardEvents, Status, WSCodes, WSEvents } = require('../../util/Constants');
const Util = require('../../util/Util');
Expand Down Expand Up @@ -120,7 +120,7 @@ class WebSocketManager extends EventEmitter {
* @private
*/
async connect() {
const invalidToken = new DJSError(WSCodes[4004]);
const invalidToken = new Error(WSCodes[4004]);
const {
url: gatewayURL,
shards: recommendedShards,
Expand Down Expand Up @@ -241,7 +241,7 @@ class WebSocketManager extends EventEmitter {
await shard.connect();
} catch (error) {
if (error && error.code && UNRECOVERABLE_CLOSE_CODES.includes(error.code)) {
throw new DJSError(WSCodes[error.code]);
throw new Error(WSCodes[error.code]);
// Undefined if session is invalid, error event for regular closes
} else if (!error || error.code) {
this.debug('Failed to connect to the gateway, requeueing...', shard);
Expand Down
1 change: 1 addition & 0 deletions src/errors/Messages.js
Expand Up @@ -14,6 +14,7 @@ const Messages = {
WS_CLOSE_REQUESTED: 'WebSocket closed due to user request.',
WS_CONNECTION_EXISTS: 'There is already an existing WebSocket connection.',
WS_NOT_OPEN: (data = 'data') => `Websocket not open to send ${data}`,
MANAGER_DESTROYED: 'Manager was destroyed.',

BITFIELD_INVALID: bit => `Invalid bitfield flag or number: ${bit}.`,

Expand Down
1 change: 1 addition & 0 deletions src/managers/GuildApplicationCommandManager.js
@@ -1,6 +1,7 @@
'use strict';

const ApplicationCommandManager = require('./ApplicationCommandManager');
const { TypeError } = require('../errors');
const Collection = require('../util/Collection');
const { ApplicationCommandPermissionTypes } = require('../util/Constants');

Expand Down
1 change: 1 addition & 0 deletions src/managers/GuildBanManager.js
@@ -1,6 +1,7 @@
'use strict';

const BaseManager = require('./BaseManager');
const { TypeError, Error } = require('../errors');
const GuildBan = require('../structures/GuildBan');
const GuildMember = require('../structures/GuildMember');
const Collection = require('../util/Collection');
Expand Down
1 change: 1 addition & 0 deletions src/sharding/ShardClientUtil.js
@@ -1,5 +1,6 @@
'use strict';

const { Error } = require('../errors');
const { Events } = require('../util/Constants');
const Util = require('../util/Util');

Expand Down
1 change: 1 addition & 0 deletions src/structures/Invite.js
Expand Up @@ -2,6 +2,7 @@

const Base = require('./Base');
const IntegrationApplication = require('./IntegrationApplication');
const { Error } = require('../errors');
const { Endpoints } = require('../util/Constants');
const Permissions = require('../util/Permissions');

Expand Down
1 change: 1 addition & 0 deletions src/structures/interfaces/InteractionResponses.js
@@ -1,5 +1,6 @@
'use strict';

const { Error } = require('../../errors');
const { InteractionResponseTypes } = require('../../util/Constants');
const MessageFlags = require('../../util/MessageFlags');
const APIMessage = require('../APIMessage');
Expand Down

0 comments on commit e980948

Please sign in to comment.