feat: expose Retry-After and sublimit timeouts in RatelimitData (#9864)

* feat: expose Retry-After and sublimit timeouts in RatelimitData

* chore: better docs?

* Apply suggestions from code review

Co-authored-by: ckohen <chaikohen@gmail.com>

---------

Co-authored-by: ckohen <chaikohen@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Vlad Frangu
2023-11-12 16:36:12 +02:00
committed by GitHub
parent 62e6573296
commit 81e7866903
4 changed files with 54 additions and 14 deletions

View File

@@ -17,7 +17,22 @@ export class RateLimitError extends Error implements RateLimitData {
public global: boolean;
public constructor({ timeToReset, limit, method, hash, url, route, majorParameter, global }: RateLimitData) {
public retryAfter: number;
public sublimitTimeout: number;
public constructor({
timeToReset,
limit,
method,
hash,
url,
route,
majorParameter,
global,
retryAfter,
sublimitTimeout,
}: RateLimitData) {
super();
this.timeToReset = timeToReset;
this.limit = limit;
@@ -27,6 +42,8 @@ export class RateLimitError extends Error implements RateLimitData {
this.route = route;
this.majorParameter = majorParameter;
this.global = global;
this.retryAfter = retryAfter;
this.sublimitTimeout = sublimitTimeout;
}
/**