mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +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
|
||||
versionedData = migratedData
|
||||
} 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)
|
||||
const error = new Error(`MetaMask Migration Error #${migration.version}:\n${err.stack}`)
|
||||
this.emit('error', error)
|
||||
this.emit('error', err)
|
||||
// stop migrating and use state as is
|
||||
return versionedData
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user