Skip to content

Commit

Permalink
Add generic message for errors during sign operation
Browse files Browse the repository at this point in the history
  • Loading branch information
OKendigelyan committed Dec 3, 2024
1 parent 590e69a commit 6802a24
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
20 changes: 12 additions & 8 deletions apps/web/src/components/SendFlow/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,18 @@ export const useSignPageHelpers = (
).catch(() => setEstimationFailed(true));

const onSign = async (tezosToolkit: TezosToolkit) =>
handleAsyncAction(async () => {
const operation = await executeOperations(
{ ...operations, estimates: form.watch("executeParams") },
tezosToolkit
);
await openWith(<SuccessStep hash={operation.opHash} />);
return operation;
});
handleAsyncAction(
async () => {
const operation = await executeOperations(
{ ...operations, estimates: form.watch("executeParams") },
tezosToolkit
);
await openWith(<SuccessStep hash={operation.opHash} />);
return operation;
},
// Here we should show a generic error message, keeping the original error for errors list
{ description: "Something went wrong, please try again." }
);

return {
fee: totalFee(form.watch("executeParams")),
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/estimate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export const handleTezError = (err: Error): string => {
return "Contract does not exist, please check if the correct network is selected.";
} else if (err.message.includes("staking_to_delegate_that_refuses_external_staking")) {
return "The baker you are trying to stake to does not accept external staking.";
} else if (err.message.includes("empty_implicit_delegated_contract")) {
return "Emptying an implicit delegated account is not allowed.";
}

return err.message;
};

0 comments on commit 6802a24

Please sign in to comment.