Archived
0
0
Fork 0

feat(api): throw error on retry limit

This commit is contained in:
Daryl Ronningen 2021-07-07 12:51:13 -05:00
parent 3f96cc43a0
commit 1428b79ea0
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B

View file

@ -50,6 +50,8 @@ export class ApiHandler {
} }
public async makeRequest<T>(routeId: IRouteIdentifier, options: IMakeRequestOptions, retries = 0): Promise<T> { public async makeRequest<T>(routeId: IRouteIdentifier, options: IMakeRequestOptions, retries = 0): Promise<T> {
if (retries === this.client.options.api.retryLimit) throw new Error('Retry limit has been exceeded!');
const headers: Map<string, string> = new Map(); const headers: Map<string, string> = new Map();
if (options.headers) for (const prop in options.headers) headers.set(prop, options.headers[prop]!); if (options.headers) for (const prop in options.headers) headers.set(prop, options.headers[prop]!);