Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #437 from nervosnetwork/update-error-data
Browse files Browse the repository at this point in the history
fix: Update revert error message and data
  • Loading branch information
RetricSu authored Jul 14, 2022
2 parents de3be9c + e11b89e commit 22dcbeb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/api-server/src/methods/gw-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ const revertErrorMapping: RevertErrorMapping = {
},
// Error(string)
"0x08c379a0": {
message: (args: any[]) => `Error(${args[0]})`,
message: (args: any[]) =>
`Error: VM Exception while processing transaction: reverted with reason string '${args[0]}'`,
argTypes: ["string"],
},
};
Expand Down Expand Up @@ -284,7 +285,7 @@ export function parseGwRunResultError(err: any): RpcError {
if (gwErr.statusReason != null) {
failedReason.message = gwErr.statusReason;
}
let errorData: any = undefined;
let errorData: any = {};
if (Object.keys(failedReason).length !== 0) {
errorData = { failed_reason: failedReason };
}
Expand All @@ -297,5 +298,7 @@ export function parseGwRunResultError(err: any): RpcError {
gwErr.statusReason
}`;
}
errorData.message = errorMessage;
errorData.data = (gwErr.data as any).return_data;
return new RpcError(gwErr.code, errorMessage, errorData);
}

0 comments on commit 22dcbeb

Please sign in to comment.