Skip to content

Commit

Permalink
format viem error
Browse files Browse the repository at this point in the history
  • Loading branch information
sairamplex committed Mar 18, 2024
1 parent ce8b0f7 commit 3e99fc3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/interfaces/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function NEW_ERROR<T>(

export const errMsg = (error: any): string => {
if(error instanceof BaseError){
return error.details
return error.message + "::" + error.shortMessage
}
if (error.message) {
return error.message;
Expand Down
4 changes: 2 additions & 2 deletions transactions/signTx/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ export async function signEVMTransaction(

return NO_ERROR(transaction.transactionHash as `0x${string}`);
} catch (err) {
if (err instanceof BaseWeb3Error) {
if (err instanceof BaseWeb3Error && err.toJSON().innerError) {
return NEW_ERROR("performEVMTransaction", err.toJSON().innerError);
}
if (err instanceof BaseError) {
console.log(err.shortMessage);
return NEW_ERROR("performEVMTransaction::" + err.shortMessage);
return NEW_ERROR("performEVMTransaction", err);
}
return NEW_ERROR("performEVMTransaction", err);
}
Expand Down

0 comments on commit 3e99fc3

Please sign in to comment.