| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Exceptions are thrown either by the VM or from Dart code. | 5 // Exceptions are thrown either by the VM or from Dart code. |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Interface implemented by all core library exceptions. | 8 * Interface implemented by all core library exceptions. |
| 9 * Defaults to an implementation that only carries a simple message. | 9 * Defaults to an implementation that only carries a simple message. |
| 10 */ | 10 */ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * Exception thrown because of an index outside of the valid range. | 27 * Exception thrown because of an index outside of the valid range. |
| 28 */ | 28 */ |
| 29 class IndexOutOfRangeException implements Exception { | 29 class IndexOutOfRangeException implements Exception { |
| 30 const IndexOutOfRangeException(this._value); | 30 const IndexOutOfRangeException(this._value); |
| 31 | 31 |
| 32 String toString() => "IndexOutOfRangeException: $_value"; | 32 String toString() => "IndexOutOfRangeException: $_value"; |
| 33 | 33 |
| 34 final _value; | 34 final _value; |
| 35 } | 35 } |
| 36 | 36 |
| 37 /** | |
| 38 * Exception thrown because of attempt to modify an immutable object. | |
| 39 */ | |
| 40 class IllegalAccessException implements Exception { | |
| 41 const IllegalAccessException(); | |
| 42 String toString() => "Attempt to modify an immutable object"; | |
| 43 } | |
| 44 | 37 |
| 45 /** | 38 /** |
| 46 * Exception thrown when a string or some other data does not have an expected | 39 * Exception thrown when a string or some other data does not have an expected |
| 47 * format and cannot be parsed or processed. | 40 * format and cannot be parsed or processed. |
| 48 */ | 41 */ |
| 49 class FormatException implements Exception { | 42 class FormatException implements Exception { |
| 50 /** | 43 /** |
| 51 * A message describing the format error. | 44 * A message describing the format error. |
| 52 */ | 45 */ |
| 53 final String message; | 46 final String message; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 String toString() => "NoMoreElementsException"; | 78 String toString() => "NoMoreElementsException"; |
| 86 } | 79 } |
| 87 | 80 |
| 88 | 81 |
| 89 class EmptyQueueException implements Exception { | 82 class EmptyQueueException implements Exception { |
| 90 const EmptyQueueException(); | 83 const EmptyQueueException(); |
| 91 String toString() => "EmptyQueueException"; | 84 String toString() => "EmptyQueueException"; |
| 92 } | 85 } |
| 93 | 86 |
| 94 | 87 |
| 95 class UnsupportedOperationException implements Exception { | |
| 96 const UnsupportedOperationException(String this._message); | |
| 97 String toString() => "UnsupportedOperationException: $_message"; | |
| 98 final String _message; | |
| 99 } | |
| 100 | |
| 101 | |
| 102 class NotImplementedException implements Exception { | 88 class NotImplementedException implements Exception { |
| 103 const NotImplementedException([String message]) : this._message = message; | 89 const NotImplementedException([String message]) : this._message = message; |
| 104 String toString() => (this._message !== null | 90 String toString() => (this._message !== null |
| 105 ? "NotImplementedException: $_message" | 91 ? "NotImplementedException: $_message" |
| 106 : "NotImplementedException"); | 92 : "NotImplementedException"); |
| 107 final String _message; | 93 final String _message; |
| 108 } | 94 } |
| 109 | 95 |
| 110 | 96 |
| 111 class IllegalJSRegExpException implements Exception { | 97 class IllegalJSRegExpException implements Exception { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 122 } | 108 } |
| 123 | 109 |
| 124 /** | 110 /** |
| 125 * Exception thrown when a runtime error occurs. | 111 * Exception thrown when a runtime error occurs. |
| 126 */ | 112 */ |
| 127 class RuntimeError implements Exception { | 113 class RuntimeError implements Exception { |
| 128 final message; | 114 final message; |
| 129 RuntimeError(this.message); | 115 RuntimeError(this.message); |
| 130 String toString() => "RuntimeError: $message"; | 116 String toString() => "RuntimeError: $message"; |
| 131 } | 117 } |
| OLD | NEW |