Skip to content

Commit

Permalink
feat: more informative logging in case of migration failure (#8307)
Browse files Browse the repository at this point in the history
* More informative log about migration failure

* Update MigrationExecutor.ts

Co-authored-by: Ruslan Terekhov <ruslan.t@upland.me>
Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
  • Loading branch information
3 people committed Oct 28, 2021
1 parent bc55836 commit dc6f1c9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/migration/MigrationExecutor.ts
Expand Up @@ -228,6 +228,10 @@ export class MigrationExecutor {
}

await migration.instance!.up(queryRunner)
.catch(error => { // informative log about migration failure
this.connection.logger.logMigration(`Migration "${migration.name}" has been failed, error: ${error?.message}`);
throw error;
})
.then(async () => { // now when migration is executed we need to insert record about it into the database
await this.insertExecutedMigration(queryRunner, migration);
// commit transaction if we started it
Expand Down

0 comments on commit dc6f1c9

Please sign in to comment.