mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 20:02:58 +01:00
Log before and after each migration run (#20424)
* Log before and after each migration run * Use loglevel
This commit is contained in:
parent
72d20c92d6
commit
442181de94
@ -1,4 +1,5 @@
|
||||
import EventEmitter from 'events';
|
||||
import log from 'loglevel';
|
||||
|
||||
/**
|
||||
* @typedef {object} Migration
|
||||
@ -36,6 +37,8 @@ export default class Migrator extends EventEmitter {
|
||||
// perform each migration
|
||||
for (const migration of pendingMigrations) {
|
||||
try {
|
||||
log.info(`Running migration ${migration.version}...`);
|
||||
|
||||
// attempt migration and validate
|
||||
const migratedData = await migration.migrate(versionedData);
|
||||
if (!migratedData.data) {
|
||||
@ -52,6 +55,8 @@ export default class Migrator extends EventEmitter {
|
||||
// accept the migration as good
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
versionedData = migratedData;
|
||||
|
||||
log.info(`Migration ${migration.version} complete`);
|
||||
} catch (err) {
|
||||
// rewrite error message to add context without clobbering stack
|
||||
const originalErrorMessage = err.message;
|
||||
|
Loading…
Reference in New Issue
Block a user