fix(ivy): improve error message when NgModule properties are not arrays (#30796)

PR Close #30796
This commit is contained in:
Matt Lewis 2019-05-31 19:26:40 -04:00 committed by Kara Erickson
parent f0395836b6
commit 91008bd979

View File

@ -396,7 +396,7 @@ export class NgModuleDecoratorHandler implements DecoratorHandler<NgModuleAnalys
if (!Array.isArray(resolvedList)) {
throw new FatalDiagnosticError(
ErrorCode.VALUE_HAS_WRONG_TYPE, expr,
`Expected array when reading property ${arrayName}`);
`Expected array when reading the NgModule.${arrayName} of ${className}`);
}
resolvedList.forEach((entry, idx) => {
@ -413,14 +413,14 @@ export class NgModuleDecoratorHandler implements DecoratorHandler<NgModuleAnalys
if (!this.isClassDeclarationReference(entry)) {
throw new FatalDiagnosticError(
ErrorCode.VALUE_HAS_WRONG_TYPE, entry.node,
`Value at position ${idx} in the NgModule.${arrayName}s of ${className} is not a class`);
`Value at position ${idx} in the NgModule.${arrayName} of ${className} is not a class`);
}
refList.push(entry);
} else {
// TODO(alxhub): Produce a better diagnostic here - the array index may be an inner array.
throw new FatalDiagnosticError(
ErrorCode.VALUE_HAS_WRONG_TYPE, expr,
`Value at position ${idx} in the NgModule.${arrayName}s of ${className} is not a reference: ${entry}`);
`Value at position ${idx} in the NgModule.${arrayName} of ${className} is not a reference: ${entry}`);
}
});