throwErrorsIfAny method
void
throwErrorsIfAny()
Converts and throws exceptions
as a BuildError.
If no exceptions
were collected during parsing no error is thrown.
Implementation
void throwErrorsIfAny() {
if (exceptions.isEmpty) {
return;
}
final sourceFile = SourceFile.fromString(_contents, url: _sourceUrl);
throw BuildError.fromMultiple(
exceptions.map(
(e) => BuildError.forSourceSpan(
sourceFile.span(e.offset!, e.offset! + e.length!),
e.errorCode.message,
),
),
'Errors in $_sourceUrl while compiling component $_directiveName',
);
}