Skip to content

Commit

Permalink
fix(material/schematics): improve logging of mdc-migration ts migrator (
Browse files Browse the repository at this point in the history
#26377)

* fix(material/schematics): improve logging of mdc-migration ts migrator

* related to issue #26038

* fixup! fix(material/schematics): improve logging of mdc-migration ts migrator

(cherry picked from commit f56bd5c)
  • Loading branch information
wagnermaciel committed Jan 24, 2023
1 parent 419c738 commit 8465f9e
Showing 1 changed file with 18 additions and 8 deletions.
Expand Up @@ -24,14 +24,24 @@ export class RuntimeCodeMigration extends Migration<ComponentMigrator[], Schemat
private _hasPossibleTemplateMigrations = true;

override visitNode(node: ts.Node): void {
if (ts.isSourceFile(node)) {
this._migrateSourceFileReferences(node);
} else if (this._isComponentDecorator(node)) {
this._migrateComponentDecorator(node as ts.Decorator);
} else if (this._isImportExpression(node)) {
this._migrateModuleSpecifier(node.arguments[0]);
} else if (this._isTypeImportExpression(node)) {
this._migrateModuleSpecifier(node.argument.literal);
try {
if (ts.isSourceFile(node)) {
this._migrateSourceFileReferences(node);
} else if (this._isComponentDecorator(node)) {
this._migrateComponentDecorator(node as ts.Decorator);
} else if (this._isImportExpression(node)) {
this._migrateModuleSpecifier(node.arguments[0]);
} else if (this._isTypeImportExpression(node)) {
this._migrateModuleSpecifier(node.argument.literal);
}
} catch (e) {
this.context.logger.error(`${e}`);
if (e instanceof Error) {
this.logger.error(`${e.stack}`);
}
this.context.logger.warn(
`Failed to process file: ${node.getSourceFile().fileName} (see error above).`,
);
}
}

Expand Down

0 comments on commit 8465f9e

Please sign in to comment.