Skip to content

Commit

Permalink
update error message parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
uncoolzero committed Jul 9, 2024
1 parent 5cc483f commit 16d3843
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions projects/ui/src/util/Ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,14 @@ export const parseError = (error: any) => {
case 'UNSUPPORTED_OPERATION':
case 'CALL_EXCEPTION':
if (error.reason) {
errorMessage.message = error.reason.replace('execution reverted: ', '');
return errorMessage;
if (error.reason.includes('viem')) {
const _message = error.reason.substring(error.reason.indexOf('execution reverted: '));
errorMessage.message = _message.replace('execution reverted: ', '');
return errorMessage;
} else {
errorMessage.message = error.reason.replace('execution reverted: ', '');
return errorMessage;
}
}

if (error.data && error.data.message) {
Expand Down

0 comments on commit 16d3843

Please sign in to comment.