Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 2x 2x 5x 5x 1x | import { ISettingsMigration } from './settings-migration.interface';
import { ISettingsMigrationService } from './settings-migration-service.interface';
import { getLog } from '@src/utilities/vscode/log';
/**
* Owns the registry of settings migrations and runs them on activation.
*
* Migrations run on every activation and must be idempotent. Adding a new
* migration is a matter of registering it where this service is constructed; no
* change to the activation flow is required.
*/
export class SettingsMigrationService implements ISettingsMigrationService {
constructor(private readonly migrations: ReadonlyArray<ISettingsMigration>) { }
async runMigrations(): Promise<void> {
for (const migration of this.migrations) {
try {
await migration.migrate();
} catch (error) {
// Isolate failures so one bad migration does not block the rest or activation.
getLog().error(`Settings migration "${migration.id}" failed:`, error);
}
}
}
}
|