Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(*): add missing imports for custom errors #5767

Merged
merged 2 commits into from Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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