| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 * interface method's argument name (or just rename arguments to match). | 158 * interface method's argument name (or just rename arguments to match). |
| 159 */ | 159 */ |
| 160 ArgumentError.value(value, | 160 ArgumentError.value(value, |
| 161 [String this.name, | 161 [String this.name, |
| 162 String this.message]) | 162 String this.message]) |
| 163 : invalidValue = value, | 163 : invalidValue = value, |
| 164 _hasValue = true; | 164 _hasValue = true; |
| 165 | 165 |
| 166 /** | 166 /** |
| 167 * Create an argument error for a `null` argument that must not be `null`. | 167 * Create an argument error for a `null` argument that must not be `null`. |
| 168 * | |
| 169 * Shorthand for calling [ArgumentError.value] with a `null` value and a | |
| 170 * message of `"Must not be null"`. | |
| 171 */ | 168 */ |
| 172 ArgumentError.notNull([String name]) | 169 ArgumentError.notNull([this.name]) |
| 173 : this.value(null, name, "Must not be null"); | 170 : _hasValue = false, |
| 171 message = "Must not be null", |
| 172 invalidValue = null; |
| 174 | 173 |
| 175 // Helper functions for toString overridden in subclasses. | 174 // Helper functions for toString overridden in subclasses. |
| 176 String get _errorName => "Invalid argument${!_hasValue ? "(s)" : ""}"; | 175 String get _errorName => "Invalid argument${!_hasValue ? "(s)" : ""}"; |
| 177 String get _errorExplanation => ""; | 176 String get _errorExplanation => ""; |
| 178 | 177 |
| 179 String toString() { | 178 String toString() { |
| 180 String nameString = ""; | 179 String nameString = ""; |
| 181 if (name != null) { | 180 if (name != null) { |
| 182 nameString = " ($name)"; | 181 nameString = " ($name)"; |
| 183 } | 182 } |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 * 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 |
| 566 * another read of the variable, this error is thrown. | 565 * another read of the variable, this error is thrown. |
| 567 */ | 566 */ |
| 568 class CyclicInitializationError extends Error { | 567 class CyclicInitializationError extends Error { |
| 569 final String variableName; | 568 final String variableName; |
| 570 CyclicInitializationError([this.variableName]); | 569 CyclicInitializationError([this.variableName]); |
| 571 String toString() => variableName == null | 570 String toString() => variableName == null |
| 572 ? "Reading static variable during its initialization" | 571 ? "Reading static variable during its initialization" |
| 573 : "Reading static variable '$variableName' during its initialization"; | 572 : "Reading static variable '$variableName' during its initialization"; |
| 574 } | 573 } |
| OLD | NEW |