mapException method
Maps error
's span in the string generated from this interpolation to its
original source.
Implementation
FormatException mapException(SourceSpanFormatException error) {
var target = error.span;
if (target == null) return error;
var source = mapSpan(target);
var startIndex = _indexInContents(target.start);
var endIndex = _indexInContents(target.end);
if (!_interpolation.contents
.skip(startIndex)
.take(endIndex - startIndex + 1)
.any((content) => content is Expression)) {
return SourceSpanFormatException(error.message, source, error.source);
} else {
return MultiSourceSpanFormatException(error.message, source, "",
{target: "error in interpolated output"}, error.source);
}
}