Skip to content

Commit

Permalink
handleErrorSwap
Browse files Browse the repository at this point in the history
  • Loading branch information
marxeille committed Oct 14, 2024
1 parent 800d4c6 commit a098b8a
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions apps/mobile/src/screens/universal-swap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -690,31 +690,20 @@ export const UniversalSwapScreen: FunctionComponent = observer(() => {

const handleSwapError = async (error, retryCount) => {
console.log("error handleSubmit", error);
if (
error.message.includes("of undefined") ||
error.message.includes("Rejected")
) {
handleErrorSwap(error?.message ?? error?.ex?.message);
setSwapLoading(false);
return;
}

handleErrorSwap(error?.message ?? error?.ex?.message);
setSwapLoading(false);
if (
error.message.includes("Bad status on response") ||
error.message.includes("403") ||
originalFromToken.chainId === ChainIdEnum.Injective
) {
let retry = retryCount + 1;
console.log("error.message", error.message, retry);
if (retry < 4) {
await handleSubmit(retry);
} else {
handleErrorSwap(error?.message ?? error?.ex?.message);
setSwapLoading(false);
}
} else {
handleErrorSwap(error?.message ?? error?.ex?.message);
setSwapLoading(false);
}
};

Expand Down

0 comments on commit a098b8a

Please sign in to comment.