Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix #7392: Error formatting for Ethereum DApp responses #7393

Merged
merged 1 commit into from
May 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ if (window.isSecureContext) {
"args": JSON.stringify(payload)
})
.then(resolve, (errorJSON) => {
/* remove `Error: ` prefix. errorJSON=`Error: {code: 1, errorMessage: "Internal error"}` */
const errorJSONString = new String(errorJSON);
const errorJSONStringSliced = errorJSONString.slice(errorJSONString.indexOf('{'));
try {
reject(JSON.parse(errorJSON))
reject(JSON.parse(errorJSONStringSliced))
} catch(e) {
reject(errorJSON)
}
Expand Down