fix(compiler): warning prints "WARNING" instead of "ERROR" (#15125)

This commit is contained in:
Victor Berchet
2017-03-14 17:12:44 -07:00
committed by Chuck Jazdzewski
parent 3c15916e17
commit 3b1956bbf2
4 changed files with 38 additions and 9 deletions

View File

@ -161,7 +161,7 @@ export class BindingParser {
this._reportError(
`Assigning animation triggers via @prop="exp" attributes with an expression is invalid.` +
` Use property bindings (e.g. [@prop]="exp") or use an attribute without a value (e.g. @prop) instead.`,
sourceSpan, ParseErrorLevel.FATAL);
sourceSpan, ParseErrorLevel.ERROR);
}
this._parseAnimation(name, value, sourceSpan, targetMatchableAttrs, targetProps);
} else {
@ -366,7 +366,7 @@ export class BindingParser {
private _reportError(
message: string, sourceSpan: ParseSourceSpan,
level: ParseErrorLevel = ParseErrorLevel.FATAL) {
level: ParseErrorLevel = ParseErrorLevel.ERROR) {
this._targetErrors.push(new ParseError(sourceSpan, message, level));
}
@ -405,7 +405,7 @@ export class BindingParser {
const report = isAttr ? this._schemaRegistry.validateAttribute(propName) :
this._schemaRegistry.validateProperty(propName);
if (report.error) {
this._reportError(report.msg, sourceSpan, ParseErrorLevel.FATAL);
this._reportError(report.msg, sourceSpan, ParseErrorLevel.ERROR);
}
}
}

View File

@ -98,7 +98,7 @@ export class TemplateParser {
templateUrl: string): {template: TemplateAst[], pipes: CompilePipeSummary[]} {
const result = this.tryParse(component, template, directives, pipes, schemas, templateUrl);
const warnings = result.errors.filter(error => error.level === ParseErrorLevel.WARNING);
const errors = result.errors.filter(error => error.level === ParseErrorLevel.FATAL);
const errors = result.errors.filter(error => error.level === ParseErrorLevel.ERROR);
if (warnings.length > 0) {
this._console.warn(`Template parse warnings:\n${warnings.join('\n')}`);
@ -196,7 +196,7 @@ export class TemplateParser {
} else {
const error = new TemplateParseError(
`Reference "#${name}" is defined several times`, reference.sourceSpan,
ParseErrorLevel.FATAL);
ParseErrorLevel.ERROR);
errors.push(error);
}
}));
@ -731,7 +731,7 @@ class TemplateParseVisitor implements html.Visitor {
private _reportError(
message: string, sourceSpan: ParseSourceSpan,
level: ParseErrorLevel = ParseErrorLevel.FATAL) {
level: ParseErrorLevel = ParseErrorLevel.ERROR) {
this._targetErrors.push(new ParseError(sourceSpan, message, level));
}
}