Skip to content

Commit

Permalink
Fix #1214 by adding more info in the ratelimited error exception mess…
Browse files Browse the repository at this point in the history
…age (#1312)

* Fix #1214 by adding more info in the ratelimited error exception message
* Add url to the invalid retry-after data pattern as well
  • Loading branch information
seratch authored Aug 18, 2021
1 parent 4b44424 commit 7b95663
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/web-api/src/WebClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,11 @@ export class WebClient extends Methods {
await delay(retrySec * 1000);
// resume the request queue and throw a non-abort error to signal a retry
this.requestQueue.start();
throw Error('A rate limit was exceeded.');
// TODO: We may want to have more detailed info such as team_id, params except tokens, and so on.
throw Error(`A rate limit was exceeded (url: ${url}, retry-after: ${retrySec})`);
} else {
// TODO: turn this into some CodedError
throw new AbortError(new Error('Retry header did not contain a valid timeout.'));
throw new AbortError(new Error(`Retry header did not contain a valid timeout (url: ${url})`));
}
}

Expand Down

0 comments on commit 7b95663

Please sign in to comment.