Skip to content

Commit

Permalink
we need to reject rather than throw
Browse files Browse the repository at this point in the history
  • Loading branch information
DonovanDMC committed Aug 18, 2024
1 parent 85d6538 commit 20ea410
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rest/RequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 20ea410

Please sign in to comment.