Skip to content

Commit

Permalink
feat: distinguish between source of the error
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechsimetka committed Oct 26, 2023
1 parent 31b1be5 commit bf588d8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/lib/objects/payggy/views/confirm-send.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
fee = await estimateTransaction(toUser.address, tokenToTransfer)
} catch (e) {
addError({
title: 'Blockchain error',
title: 'Payggy error',
message: `Failed to estimate transaction fee. ${(e as Error).message}`,
retry: tryEstimateTransaction,
ok: true,
Expand All @@ -55,7 +55,7 @@
async function sendTransactionInternal() {
if (!fee) {
addError({
title: 'Blockchain error',
title: 'Payggy error',
message: 'No estimated transaction fee.',
ok: true,
})
Expand All @@ -73,7 +73,7 @@
exitObject()
} catch (error) {
addError({
title: 'Error',
title: 'Payggy Error',
message: `Failed to send transaction. ${(error as Error).message}`,
retry: sendTransactionInternal,
ok: true,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/objects/split/chat-messages/settle-reminder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
export let onViewChange: (view: View, ...rest: string[]) => void
let owedAmount = BigInt(0)
let owedAmount = 0n
$: {
const balance = balances.find(({ address }) => address === profile.address)
if (balance) {
Expand Down
6 changes: 5 additions & 1 deletion src/lib/objects/split/views/choose-images.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import Add from '$lib/components/icons/add.svelte'
import TrashCan from '$lib/components/icons/trash-can.svelte'
import { errorStore } from '$lib/stores/error'
import Loading from '$lib/components/loading.svelte'
export let images: string[]
export let exitObject: () => void
Expand All @@ -33,7 +34,7 @@
} catch (error) {
// Here the retry functionality is not really that straight forward so we ask user to reupload if they want to.
errorStore.addEnd({
title: 'Upload error',
title: 'Splitter error',
message: `Failed to upload image ${image.name}. Please try and add it again. ${
(error as Error)?.message
}`,
Expand Down Expand Up @@ -86,6 +87,9 @@
<InputFile multiple bind:files size={128} borderRadius={12} margin="none">
<Add size={32} />
</InputFile>
{#if uploading}
<Loading />
{/if}
{#each images as image}
<Image picture={image}>
<Button variant="icon" on:click={() => removeImage(image)}><TrashCan /></Button>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/objects/split/views/settle-now.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
owedAmount = await getOwedAmount(getContract, splitterAddress, profile.address)
} catch (error) {
addError({
title: 'Blockchain error',
title: 'Splitter error',
message: `Failed to retrieve owed amount. ${(error as Error).message}`,
retry: tryGetOwedAmount,
})
Expand All @@ -63,7 +63,7 @@
} catch (error) {
feeError = error as Error
addError({
title: 'Blockchain error',
title: 'Splitter error',
message: `Failed to estimate fee ${feeError?.message}`,
retry: tryEstimateSettleDebt,
})
Expand Down
4 changes: 2 additions & 2 deletions src/lib/objects/split/views/summary.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
)
} catch (error) {
addError({
title: 'Blockchain error',
title: 'Splitter error',
message: `Failed to estimate gas fee. ${(error as Error)?.message}`,
ok: true,
retry: () => tryEstimateFee(users, amount, token),
Expand Down Expand Up @@ -110,7 +110,7 @@
exitObject()
} catch (error) {
addError({
title: 'Blockchain error',
title: 'Splitter error',
message: `Failed to send transaction. ${(error as Error)?.message}`,
ok: true,
retry: sendTransactionInternal,
Expand Down

0 comments on commit bf588d8

Please sign in to comment.