mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +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 EventEmitter from 'events';
|
||||||
|
import log from 'loglevel';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} Migration
|
* @typedef {object} Migration
|
||||||
@ -36,6 +37,8 @@ export default class Migrator extends EventEmitter {
|
|||||||
// perform each migration
|
// perform each migration
|
||||||
for (const migration of pendingMigrations) {
|
for (const migration of pendingMigrations) {
|
||||||
try {
|
try {
|
||||||
|
log.info(`Running migration ${migration.version}...`);
|
||||||
|
|
||||||
// attempt migration and validate
|
// attempt migration and validate
|
||||||
const migratedData = await migration.migrate(versionedData);
|
const migratedData = await migration.migrate(versionedData);
|
||||||
if (!migratedData.data) {
|
if (!migratedData.data) {
|
||||||
@ -52,6 +55,8 @@ export default class Migrator extends EventEmitter {
|
|||||||
// accept the migration as good
|
// accept the migration as good
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
versionedData = migratedData;
|
versionedData = migratedData;
|
||||||
|
|
||||||
|
log.info(`Migration ${migration.version} complete`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// rewrite error message to add context without clobbering stack
|
// rewrite error message to add context without clobbering stack
|
||||||
const originalErrorMessage = err.message;
|
const originalErrorMessage = err.message;
|
||||||
|
Loading…
Reference in New Issue
Block a user