Skip to content

Commit

Permalink
fix: handle no connection fetch error
Browse files Browse the repository at this point in the history
  • Loading branch information
JackHamer09 committed Jan 10, 2024
1 parent 0f03566 commit 69f3213
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pages/assets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<template v-if="loading">
<TokenBalanceLoader v-for="index in 2" :key="index" send-route-name />
</template>
<div v-else-if="balanceError" class="m-3 -mt-1 mb-2.5">
<div v-else-if="balanceError">
<CommonErrorBlock @try-again="fetch">
{{ balanceError.message }}
</CommonErrorBlock>
Expand Down
7 changes: 6 additions & 1 deletion utils/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ export function formatError(error?: Error) {
return undefined;
} else if (message.toLowerCase().includes("fee is to low")) {
return new Error("Transaction fee was to low. Try again.");
} else if (message === "Network Error" || message === "Failed to fetch ()" || message.includes("noNetwork")) {
} else if (
message === "Network Error" ||
message === "Failed to fetch ()" ||
message.includes("<no response> Failed to fetch") ||
message.includes("noNetwork")
) {
return new Error("Network error. Check your internet connection and try again.");
}
}
Expand Down

0 comments on commit 69f3213

Please sign in to comment.