| 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 part of dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Error objects thrown in the case of a program failure. | 8 * Error objects thrown in the case of a program failure. |
| 9 * | 9 * |
| 10 * An `Error` object represents a program failure that the programmer | 10 * An `Error` object represents a program failure that the programmer |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 /** | 115 /** |
| 116 * Error thrown when attempting to throw [:null:]. | 116 * Error thrown when attempting to throw [:null:]. |
| 117 */ | 117 */ |
| 118 class NullThrownError extends Error { | 118 class NullThrownError extends Error { |
| 119 String toString() => "Throw of null."; | 119 String toString() => "Throw of null."; |
| 120 } | 120 } |
| 121 | 121 |
| 122 /** | 122 /** |
| 123 * Error thrown when attempting to dereference [:null:]. | |
| 124 */ | |
| 125 class NullDereferenceError extends Error implements NoSuchMethodError { | |
| 126 /** Message describing the problem. */ | |
| 127 final message; | |
| 128 | |
| 129 /** | |
| 130 * The [message] optionally describes the circumstances | |
| 131 * under which [:null:] was dereferenced. | |
| 132 */ | |
| 133 NullDereferenceError([this.message]); | |
| 134 | |
| 135 String toString() { | |
| 136 return "Cannot dereference null.${ message != null ? ' $message' : ''}"; | |
| 137 } | |
| 138 } | |
| 139 | |
| 140 /** | |
| 141 * Error thrown when a function is passed an unacceptable argument. | 123 * Error thrown when a function is passed an unacceptable argument. |
| 142 */ | 124 */ |
| 143 class ArgumentError extends Error { | 125 class ArgumentError extends Error { |
| 144 /** Whether value was provided. */ | 126 /** Whether value was provided. */ |
| 145 final bool _hasValue; | 127 final bool _hasValue; |
| 146 /** The invalid value. */ | 128 /** The invalid value. */ |
| 147 final invalidValue; | 129 final invalidValue; |
| 148 /** Name of the invalid argument, if available. */ | 130 /** Name of the invalid argument, if available. */ |
| 149 final String name; | 131 final String name; |
| 150 /** Message describing the problem. */ | 132 /** Message describing the problem. */ |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 * the first time it is read. If evaluating the initializer expression causes | 564 * the first time it is read. If evaluating the initializer expression causes |
| 583 * another read of the variable, this error is thrown. | 565 * another read of the variable, this error is thrown. |
| 584 */ | 566 */ |
| 585 class CyclicInitializationError extends Error { | 567 class CyclicInitializationError extends Error { |
| 586 final String variableName; | 568 final String variableName; |
| 587 CyclicInitializationError([this.variableName]); | 569 CyclicInitializationError([this.variableName]); |
| 588 String toString() => variableName == null | 570 String toString() => variableName == null |
| 589 ? "Reading static variable during its initialization" | 571 ? "Reading static variable during its initialization" |
| 590 : "Reading static variable '$variableName' during its initialization"; | 572 : "Reading static variable '$variableName' during its initialization"; |
| 591 } | 573 } |
| OLD | NEW |