Skip to content

Commit 89c2d8d

Browse files
authored
Namadillo - Display original SDK error if error does not indicate a ResultCode (#1991)
1 parent 01c6589 commit 89c2d8d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

apps/namadillo/src/utils/index.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,17 @@ export const toErrorDetail = (
128128
tx: TxMsgValue[],
129129
error: BroadcastTxError
130130
): string => {
131-
const { gasLimit } = tx[0].args;
132-
const { code } = error.toProps();
133-
134-
// TODO: Over time we may expand this to format errors for more result codes
135-
switch (code) {
136-
case ResultCode.TxGasLimit:
137-
return `${error.toString()} Please raise the Gas Amount above the previously provided ${gasLimit} in the fee options for your transaction.`;
138-
default:
139-
return error.toString();
131+
try {
132+
const { code } = error.toProps();
133+
// TODO: Over time we may expand this to format errors for more result codes
134+
switch (code) {
135+
case ResultCode.TxGasLimit:
136+
const { gasLimit } = tx[0].args;
137+
return `${error.toString()} Please raise the Gas Amount above the previously provided ${gasLimit} in the fee options for your transaction.`;
138+
default:
139+
return error.toString();
140+
}
141+
} catch (_e) {
142+
return `${error.toString()}`;
140143
}
141144
};

0 commit comments

Comments
 (0)