mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
refactor: clean up rate limit handling (#2694)
* refactor: clean up rate limit handling * requested changes * remove request mode option * fix dupe requests * hardcode reaction ratelimits * suggested changes * fix small thing * re-add restTimeOffset * move restTimeOffset a bit * i swear i know english its my native language ok * requested changes * fix: a bit *too* pre-emptive with ratelimits, now less so * fix: dapi error shoudl reject with path * fix: make errors in execute catchable * fix promise return * rebase is hard
This commit is contained in:
31
src/rest/HTTPError.js
Normal file
31
src/rest/HTTPError.js
Normal file
@@ -0,0 +1,31 @@
|
||||
class HTTPError extends Error {
|
||||
constructor(message, name, code, method, path) {
|
||||
super(message);
|
||||
|
||||
/**
|
||||
* The name of the error
|
||||
* @type {string}
|
||||
*/
|
||||
this.name = name;
|
||||
|
||||
/**
|
||||
* HTTP error code returned from the request
|
||||
* @type {number}
|
||||
*/
|
||||
this.code = code || 500;
|
||||
|
||||
/**
|
||||
* The HTTP method used for the request
|
||||
* @type {string}
|
||||
*/
|
||||
this.method = method;
|
||||
|
||||
/**
|
||||
* The path of the request relative to the HTTP endpoint
|
||||
* @type {string}
|
||||
*/
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HTTPError;
|
||||
Reference in New Issue
Block a user