Skip to content

Commit

Permalink
Fix ratelimit response check
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname committed Oct 18, 2023
1 parent 0fa9d08 commit cb90e84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- 429 rate limit error handling

## [3.0.1] - 2023-10-12
### Changed
Expand Down
5 changes: 4 additions & 1 deletion packages/node/src/algorand/api.connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ export class AlgorandApiConnection
formatted_error = AlgorandApiConnection.handleTimeoutError(e);
} else if (e.message.startsWith(`disconnected from `)) {
formatted_error = AlgorandApiConnection.handleDisconnectionError(e);
} else if (e.message.startsWith(`Rate Limited at endpoint`)) {
} else if (
e.message.startsWith(`Rate Limited at endpoint`) ||
(e as any).statusCode === 429
) {
formatted_error = AlgorandApiConnection.handleRateLimitError(e);
} else if (e.message.includes(`Exceeded max limit of`)) {
formatted_error = AlgorandApiConnection.handleLargeResponseError(e);
Expand Down

0 comments on commit cb90e84

Please sign in to comment.