mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Errors Standardization (#1246)
* errors and stuff * more errors * all the errors * fix build
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const querystring = require('querystring');
|
||||
const snekfetch = require('snekfetch');
|
||||
const Constants = require('../../util/Constants');
|
||||
const { Error } = require('../../errors');
|
||||
|
||||
class APIRequest {
|
||||
constructor(rest, method, path, options) {
|
||||
@@ -28,7 +28,7 @@ class APIRequest {
|
||||
} else if (this.client.token) {
|
||||
return this.client.token;
|
||||
}
|
||||
throw new Error(Constants.Errors.NO_TOKEN);
|
||||
throw new Error('TOKEN_MISSING');
|
||||
}
|
||||
|
||||
gen() {
|
||||
|
||||
@@ -3,7 +3,7 @@ const SequentialRequestHandler = require('./RequestHandlers/Sequential');
|
||||
const BurstRequestHandler = require('./RequestHandlers/Burst');
|
||||
const APIRequest = require('./APIRequest');
|
||||
const mountApi = require('./APIRouter');
|
||||
const Constants = require('../../util/Constants');
|
||||
const { Error } = require('../../errors');
|
||||
|
||||
class RESTManager {
|
||||
constructor(client) {
|
||||
@@ -39,7 +39,7 @@ class RESTManager {
|
||||
case 'burst':
|
||||
return BurstRequestHandler;
|
||||
default:
|
||||
throw new Error(Constants.Errors.INVALID_RATE_LIMIT_METHOD);
|
||||
throw new Error('RATELIMIT_INVALID_METHOD');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user