fix(compiler): show explanatory text in template errors (#20313)

Fixes: #20076

PR Close #20313
This commit is contained in:
Chuck Jazdzewski
2017-11-09 14:06:02 -08:00
committed by Jason Aden
parent 9bcd7097d0
commit 3257fcdcee
2 changed files with 33 additions and 2 deletions

View File

@ -120,12 +120,13 @@ export class ParseError {
contextualMessage(): string {
const ctx = this.span.start.getContext(100, 3);
return ctx ? ` ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` : '';
return ctx ? `${this.msg} ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` :
this.msg;
}
toString(): string {
const details = this.span.details ? `, ${this.span.details}` : '';
return `${this.msg}${this.contextualMessage()}: ${this.span.start}${details}`;
return `${this.contextualMessage()}: ${this.span.start}${details}`;
}
}