mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01: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:
parent
1ca02cb633
commit
02a4da9ad2
@ -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,
|
||||
};
|
||||
|
@ -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}`;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user