platform/graphql_parser/lib/src/language/syntax_error.dart

13 lines
296 B
Dart
Raw Normal View History

2017-01-22 23:15:53 +00:00
import 'package:source_span/source_span.dart';
class SyntaxError implements Exception {
final String message;
2018-08-02 15:17:14 +00:00
final FileSpan span;
2017-01-22 23:15:53 +00:00
2018-08-02 15:17:14 +00:00
SyntaxError(this.message, this.span);
2017-01-22 23:15:53 +00:00
@override
2018-08-04 19:18:53 +00:00
String toString() =>
'Syntax error at ${span.start.toolString}: $message\n${span.highlight()}';
2017-01-22 23:15:53 +00:00
}