mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
Moved all error strings to src/errors/messages and a few other things (#1695)
* Added missing error messages As well as `Guild#setRolePosition` and `Guild#setChannelPosition`'s first arg validation And fixed a typo in `Guild#setChannelPosition` `roles` -> `channels` * Reverted collection and Util constructors * Removed leftover messages Should have been in the second commit. * It's a single invalid permission and removed unused flag error * Fix INVALID_TOKEN -> TOKEN_INVALID as of #1703
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const snekfetch = require('snekfetch');
|
||||
const Constants = require('./Constants');
|
||||
const ConstantsHttp = Constants.DefaultOptions.http;
|
||||
const { RangeError, TypeError } = require('../errors');
|
||||
const { Error: DiscordError, RangeError, TypeError } = require('../errors');
|
||||
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ class Util {
|
||||
*/
|
||||
static fetchRecommendedShards(token, guildsPerShard = 1000) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!token) throw new Error('TOKEN_MISSING');
|
||||
if (!token) throw new DiscordError('TOKEN_MISSING');
|
||||
snekfetch.get(`${ConstantsHttp.api}/v${ConstantsHttp.version}${Constants.Endpoints.botGateway}`)
|
||||
.set('Authorization', `Bot ${token.replace(/^Bot\s*/i, '')}`)
|
||||
.end((err, res) => {
|
||||
|
||||
Reference in New Issue
Block a user