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

feat(BitField): move problematic bit into the error message #5228

Merged
merged 2 commits into from Jan 22, 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
2 changes: 1 addition & 1 deletion src/errors/Messages.js
Expand Up @@ -13,7 +13,7 @@ const Messages = {
WS_CONNECTION_EXISTS: 'There is already an existing WebSocket connection.',
WS_NOT_OPEN: (data = 'data') => `Websocket not open to send ${data}`,

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

SHARDING_INVALID: 'Invalid shard settings were provided.',
SHARDING_REQUIRED: 'This session would have handled too many guilds - Sharding is required.',
Expand Down
4 changes: 1 addition & 3 deletions src/util/BitField.js
Expand Up @@ -147,9 +147,7 @@ class BitField {
if (bit instanceof BitField) return bit.bitfield;
if (Array.isArray(bit)) return bit.map(p => this.resolve(p)).reduce((prev, p) => prev | p, 0);
if (typeof bit === 'string' && typeof this.FLAGS[bit] !== 'undefined') return this.FLAGS[bit];
const error = new RangeError('BITFIELD_INVALID');
error.bit = bit;
throw error;
throw new RangeError('BITFIELD_INVALID', bit);
}
}

Expand Down