migrator - dont overwrite error stack and warn to console

feature/default_network_editable
kumavis 7 years ago
parent 7fdf663ea7
commit ffc71ff7d2
  1. 7
      app/scripts/lib/migrator/index.js

@ -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…
Cancel
Save