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

19 lines
572 B
Dart
Raw Normal View History

2017-01-22 23:15:53 +00:00
import 'package:source_span/source_span.dart';
import 'token.dart';
class SyntaxError implements Exception {
final String message;
final int line, column;
final Token offendingToken;
SyntaxError(this.message, this.line, this.column, [this.offendingToken]);
factory SyntaxError.fromSourceLocation(
String message, SourceLocation location,
[Token offendingToken]) =>
new SyntaxError(message, location.line, location.column, offendingToken);
@override
String toString() => 'Syntax error at line $line, column $column: $message';
}