1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Fix 12145 - Ledger errors being set as Error: [object, object] (#12176)

* Fixes #12145

When transactions fail, preserve error message when presented with an error object. Fallback to stringified error for other cases.

* Perserve error stack when err.stack is present, else set stack to message.

* Use optional chaining
This commit is contained in:
Thomas Huang 2021-09-22 10:41:23 -07:00 committed by GitHub
parent 1ca02cb633
commit 02a4da9ad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -521,7 +521,7 @@ export default class TransactionStateManager extends EventEmitter {
const txMeta = this.getTransaction(txId);
txMeta.err = {
message: error.toString(),
message: error.message?.toString() || error.toString(),
rpc: error.value,
stack: error.stack,
};

View File

@ -14,7 +14,7 @@ export default function cleanErrorStack(err) {
err.stack = err.message;
} else if (msg === '') {
err.stack = err.name;
} else {
} else if (!err.stack) {
err.stack = `${err.name}: ${err.message}`;
}