diff options
author | kumavis <aaron@kumavis.me> | 2018-04-06 04:38:34 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-04-06 04:38:34 +0800 |
commit | ffc71ff7d2c27d419bff4ca127ed5219bf9261c3 (patch) | |
tree | 73406cbb58e12374649f594d89b68cfaa2f4b7b7 /app/scripts/lib | |
parent | 7fdf663ea7ae4b3c6bb5cdefb1f33729f5cf4422 (diff) | |
download | tangerine-wallet-browser-ffc71ff7d2c27d419bff4ca127ed5219bf9261c3.tar.gz tangerine-wallet-browser-ffc71ff7d2c27d419bff4ca127ed5219bf9261c3.tar.zst tangerine-wallet-browser-ffc71ff7d2c27d419bff4ca127ed5219bf9261c3.zip |
migrator - dont overwrite error stack and warn to console
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/migrator/index.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/scripts/lib/migrator/index.js b/app/scripts/lib/migrator/index.js index ea9af3c80..85c2717ea 100644 --- a/app/scripts/lib/migrator/index.js +++ b/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 } |