diff --git a/lib/rest/RequestHandler.ts b/lib/rest/RequestHandler.ts index fc24cce4..e8224bda 100644 --- a/lib/rest/RequestHandler.ts +++ b/lib/rest/RequestHandler.ts @@ -265,7 +265,7 @@ export default class RequestHandler { this._manager.client.emit("debug", `${res.headers.has("x-ratelimit-global") ? "Global" : "Unexpected"} RateLimit: ${JSON.stringify(resBody)}\n${now} ${route} ${res.status}: ${latency}ms (${this.latencyRef.latency}ms avg) | ${this.ratelimits[route].remaining}/${this.ratelimits[route].limit} left | Reset ${delay} (${this.ratelimits[route].reset - now}ms left) | Scope ${res.headers.get("x-ratelimit-scope")!}`); if (delay) { if (delay > this.options.maxRatelimitRetryWindow) { - throw new RateLimitedError(`Ratelimit on "${options.method} ${route}" exceeds the maximum retry window (${delay} > ${this.options.maxRatelimitRetryWindow})`); + reject(new RateLimitedError(`Ratelimit on "${options.method} ${route}" exceeds the maximum retry window (${delay} > ${this.options.maxRatelimitRetryWindow})`)); } setTimeout(() => { cb();