Skip to content

Commit b3817bd

Browse files
committed
fix: trycatch in case voting fails
1 parent 04605db commit b3817bd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

web/src/pages/Cases/CaseDetails/Voting/OptionsContainer.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const RefuseToArbitrateContainer = styled.div`
4646
const StyledEnsureChain = styled(EnsureChain)`
4747
align-self: center;
4848
`;
49+
4950
interface IOptions {
5051
arbitrable: `0x${string}`;
5152
handleSelection: (arg0: bigint) => Promise<void>;
@@ -69,11 +70,16 @@ const Options: React.FC<IOptions> = ({ arbitrable, handleSelection, justificatio
6970
async (id: bigint) => {
7071
setIsSending(true);
7172
setChosenOption(id);
72-
await handleSelection(id);
73-
setChosenOption(BigInt(-1));
74-
setIsSending(false);
73+
try {
74+
await handleSelection(id);
75+
} catch (error) {
76+
console.error(error);
77+
} finally {
78+
setChosenOption(BigInt(-1));
79+
setIsSending(false);
80+
}
7581
},
76-
[handleSelection, setChosenOption, setIsSending]
82+
[handleSelection]
7783
);
7884

7985
return id ? (

0 commit comments

Comments
 (0)