| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library source_span.span_exception; | 5 library source_span.span_exception; |
| 6 | 6 |
| 7 import 'span.dart'; | 7 import 'span.dart'; |
| 8 | 8 |
| 9 /// A class for exceptions that have source span information attached. | 9 /// A class for exceptions that have source span information attached. |
| 10 class SourceSpanException implements Exception { | 10 class SourceSpanException implements Exception { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 if (span == null) return message; | 29 if (span == null) return message; |
| 30 return "Error on " + span.message(message, color: color); | 30 return "Error on " + span.message(message, color: color); |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 /// A [SourceSpanException] that's also a [FormatException]. | 34 /// A [SourceSpanException] that's also a [FormatException]. |
| 35 class SourceSpanFormatException extends SourceSpanException | 35 class SourceSpanFormatException extends SourceSpanException |
| 36 implements FormatException { | 36 implements FormatException { |
| 37 final source; | 37 final source; |
| 38 | 38 |
| 39 int get position => span == null ? null : span.start.offset; | 39 int get offset => span == null ? null : span.start.offset; |
| 40 | 40 |
| 41 SourceSpanFormatException(String message, SourceSpan span, [this.source]) | 41 SourceSpanFormatException(String message, SourceSpan span, [this.source]) |
| 42 : super(message, span); | 42 : super(message, span); |
| 43 } | 43 } |
| OLD | NEW |