mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
migrator - dont overwrite error stack and warn to console
This commit is contained in:
parent
7fdf663ea7
commit
ffc71ff7d2
@ -29,9 +29,12 @@ class Migrator extends EventEmitter {
|
|||||||
// accept the migration as good
|
// accept the migration as good
|
||||||
versionedData = migratedData
|
versionedData = migratedData
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
// rewrite error message to add context without clobbering stack
|
||||||
|
const originalErrorMessage = err.message
|
||||||
|
err.message = `MetaMask Migration Error #${migration.version}: ${originalErrorMessage}`
|
||||||
|
console.warn(err.stack)
|
||||||
// emit error instead of throw so as to not break the run (gracefully fail)
|
// emit error instead of throw so as to not break the run (gracefully fail)
|
||||||
const error = new Error(`MetaMask Migration Error #${migration.version}:\n${err.stack}`)
|
this.emit('error', err)
|
||||||
this.emit('error', error)
|
|
||||||
// stop migrating and use state as is
|
// stop migrating and use state as is
|
||||||
return versionedData
|
return versionedData
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user