Skip to content

Commit e34ad72

Browse files
authored
fix(material/schematics): improve mdc-migration error logging (#26060)
* 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
1 parent 02ab0a2 commit e34ad72

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/material/schematics/ng-generate/mdc-migration/rules/template-migration.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@ export class TemplateMigration extends Migration<ComponentMigrator[], SchematicC
2626
const ast = parseTemplate(template, templateUrl);
2727
const migrators = this.upgradeData.filter(m => m.template).map(m => m.template!);
2828
const updates: Update[] = [];
29-
migrators.forEach(m => updates.push(...m.getUpdates(ast)));
29+
migrators.forEach(m => {
30+
try {
31+
updates.push(...m.getUpdates(ast));
32+
} catch (error: any) {
33+
this.logger.error(`${error}`);
34+
if (error instanceof Error) {
35+
this.logger.error(`${error.stack}`);
36+
}
37+
this.logger.warn(`Failed to process template: ${templateUrl} (see error above).`);
38+
}
39+
});
3040

3141
return writeUpdates(template, updates);
3242
}

0 commit comments

Comments
 (0)