Skip to content

Commit

Permalink
Merge pull request #362 from lidofinance/feature/si-1266-add-rate-lim…
Browse files Browse the repository at this point in the history
…it-and-cache

feat: added rate limit message
  • Loading branch information
itaven authored Jun 19, 2024
2 parents a301214 + bc9bf02 commit fcf4e6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions features/rewards/components/errorBlocks/ErrorRateLimited.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ErrorBlockBase } from './ErrorBlockBase';

export const ErrorRateLimited = () => (
<ErrorBlockBase
textProps={{ color: 'error' }}
text="API rate limit exceeded. Please, try again later."
/>
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ErrorBlockBase } from '../errorBlocks/ErrorBlockBase';
import { ErrorBlockServer } from '../errorBlocks/ErrorBlockServer';
import { ErrorRateLimited } from '../errorBlocks/ErrorRateLimited';

import { extractErrorMessage } from 'utils';
import { FetcherError } from 'utils/fetcherError';
Expand All @@ -15,5 +16,9 @@ export const RewardsListErrorMessage: React.FC<Props> = ({ error }) => {
return <ErrorBlockServer />;
}

if (error instanceof FetcherError && error.status === 429) {
return <ErrorRateLimited />;
}

return <ErrorBlockBase text={errorMessage} />;
};

0 comments on commit fcf4e6c

Please sign in to comment.