Skip to content

Commit

Permalink
fix(material/schematics): improve mdc-migration error logging (#26060)
Browse files Browse the repository at this point in the history
* fix(material/schematics): improve mdc-migration error logging

* related to issue #26038
* catch & log errors from tmpl migrations

* fixup! fix(material/schematics): improve mdc-migration error logging

(cherry picked from commit e34ad72)
  • Loading branch information
wagnermaciel committed Nov 23, 2022
1 parent 84bb660 commit a804a94
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -26,7 +26,17 @@ export class TemplateMigration extends Migration<ComponentMigrator[], SchematicC
const ast = parseTemplate(template, templateUrl);
const migrators = this.upgradeData.filter(m => m.template).map(m => m.template!);
const updates: Update[] = [];
migrators.forEach(m => updates.push(...m.getUpdates(ast)));
migrators.forEach(m => {
try {
updates.push(...m.getUpdates(ast));
} catch (error: any) {
this.logger.error(`${error}`);
if (error instanceof Error) {
this.logger.error(`${error.stack}`);
}
this.logger.warn(`Failed to process template: ${templateUrl} (see error above).`);
}
});

return writeUpdates(template, updates);
}
Expand Down

0 comments on commit a804a94

Please sign in to comment.