Skip to content

Commit

Permalink
feat: support 422 error for rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeday committed Jun 28, 2024
1 parent eddf917 commit 1f04d35
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions features/rewards/components/errorBlocks/ErrorUnprocessable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Link from 'next/link';
import { ErrorBlockBase } from './ErrorBlockBase';

export const ErrorUnprocessable = () => (
<ErrorBlockBase
textProps={{ color: 'error' }}
text={
<>
This address has too many stETH transfers. For querying such addresses
use{' '}
<Link
href={
'https://github.com/lidofinance/lido-ethereum-sdk/blob/main/packages/sdk/README.md#rewards'
}
>
Rewards Module from Lido Ethereum SDK
</Link>{' '}
and fetch rewards from subgraph directly
</>
}
/>
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ErrorRateLimited } from '../errorBlocks/ErrorRateLimited';

import { extractErrorMessage } from 'utils';
import { FetcherError } from 'utils/fetcherError';
import { ErrorUnprocessable } from '../errorBlocks/ErrorUnprocessable';

type Props = {
error: unknown;
Expand All @@ -20,5 +21,9 @@ export const RewardsListErrorMessage: React.FC<Props> = ({ error }) => {
return <ErrorRateLimited />;
}

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

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

0 comments on commit 1f04d35

Please sign in to comment.