fix(compiler): Improved error reporting of the static reflector.

StaticReflector provides more context on errors reported by the
collector.

The metadata collector now records the line and character of the node that
caused it to report the error.

Includes other minor fixes to error reporting and a wording change.

Fixes #8978
Closes #9011
This commit is contained in:
Chuck Jazdzewski
2016-06-03 15:43:09 -07:00
parent c197e2bb42
commit cf3548a02f
7 changed files with 248 additions and 39 deletions

View File

@ -191,7 +191,30 @@ export function isMetadataSymbolicSelectExpression(value: any):
export interface MetadataError {
__symbolic: 'error';
/**
* This message should be short and relatively discriptive and should be fixed once it is created.
* If the reader doesn't recognize the message, it will display the message unmodified. If the
* reader recognizes the error message is it free to use substitute message the is more
* descriptive and/or localized.
*/
message: string;
/**
* The line number of the error in the .ts file the metadata was created for.
*/
line?: number;
/**
* The number of utf8 code-units from the beginning of the file of the error.
*/
character?: number;
/**
* Context information that can be used to generate a more descriptive error message. The content
* of the context is dependent on the error message.
*/
context?: {[name: string]: string};
}
export function isMetadataError(value: any): value is MetadataError {
return value && value.__symbolic === 'error';