Skip to content

Commit

Permalink
Make tx error work
Browse files Browse the repository at this point in the history
  • Loading branch information
nmalzieu committed Oct 17, 2024
1 parent c410eef commit 46016af
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/TransactionPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,19 @@ export function TransactionPreview() {
close(transactionReceipt);
}, 1000);
}
} catch (e) {
} catch (e: any) {
if (`${e}`.includes("User rejected the request")) {
setTxState({ status: "pending" });
} else {
logger.error(e);
setTxState({ status: "failure", error: `${e}` });
let txError = e?.message;
if (!txError) {
try {
txError = JSON.stringify(e);
} catch {}
}
if (!txError) txError = e;
setTxState({ status: "failure", error: `${txError}` });
}
}
}, [close, sendTransaction, transactionToPreview]);
Expand Down

0 comments on commit 46016af

Please sign in to comment.