| 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; | |
| 6 | |
| 7 import 'span.dart'; | 5 import 'span.dart'; |
| 8 | 6 |
| 9 /// A class for exceptions that have source span information attached. | 7 /// A class for exceptions that have source span information attached. |
| 10 class SourceSpanException implements Exception { | 8 class SourceSpanException implements Exception { |
| 11 /// A message describing the exception. | 9 /// A message describing the exception. |
| 12 final String message; | 10 final String message; |
| 13 | 11 |
| 14 /// The span associated with this exception. | 12 /// The span associated with this exception. |
| 15 /// | 13 /// |
| 16 /// This may be `null` if the source location can't be determined. | 14 /// This may be `null` if the source location can't be determined. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 /// A [SourceSpanException] that's also a [FormatException]. | 32 /// A [SourceSpanException] that's also a [FormatException]. |
| 35 class SourceSpanFormatException extends SourceSpanException | 33 class SourceSpanFormatException extends SourceSpanException |
| 36 implements FormatException { | 34 implements FormatException { |
| 37 final source; | 35 final source; |
| 38 | 36 |
| 39 int get offset => span == null ? null : span.start.offset; | 37 int get offset => span == null ? null : span.start.offset; |
| 40 | 38 |
| 41 SourceSpanFormatException(String message, SourceSpan span, [this.source]) | 39 SourceSpanFormatException(String message, SourceSpan span, [this.source]) |
| 42 : super(message, span); | 40 : super(message, span); |
| 43 } | 41 } |
| OLD | NEW |