| 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; | |
| 6 | |
| 7 class Error { | 5 class Error { |
| 8 const Error(); | 6 const Error(); |
| 9 | 7 |
| 10 /** | 8 /** |
| 11 * Safely convert a value to a [String] description. | 9 * Safely convert a value to a [String] description. |
| 12 * | 10 * |
| 13 * The conversion is guaranteed to not throw, so it won't use the object's | 11 * The conversion is guaranteed to not throw, so it won't use the object's |
| 14 * toString method. | 12 * toString method. |
| 15 */ | 13 */ |
| 16 static String safeToString(Object object) { | 14 static String safeToString(Object object) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 68 |
| 71 String toString() { | 69 String toString() { |
| 72 if (message != null) { | 70 if (message != null) { |
| 73 return "Illegal argument(s): $message"; | 71 return "Illegal argument(s): $message"; |
| 74 } | 72 } |
| 75 return "Illegal argument(s)"; | 73 return "Illegal argument(s)"; |
| 76 } | 74 } |
| 77 } | 75 } |
| 78 | 76 |
| 79 /** | 77 /** |
| 80 * Error thrown because of an index outside of the valid range. | 78 * Exception thrown because of an index outside of the valid range. |
| 81 * | 79 * |
| 82 */ | 80 */ |
| 83 class RangeError extends ArgumentError { | 81 class RangeError extends ArgumentError { |
| 84 // TODO(lrn): This constructor should be called only with string values. | 82 // TODO(lrn): This constructor should be called only with string values. |
| 85 // It currently isn't in all cases. | 83 // It currently isn't in all cases. |
| 86 /** | 84 /** |
| 87 * Create a new [RangeError] with the given [message]. | 85 * Create a new [RangeError] with the given [message]. |
| 88 * | 86 * |
| 89 * Temporarily made const for backwards compatibilty. | 87 * Temporarily made const for backwards compatibilty. |
| 90 */ | 88 */ |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 247 } |
| 250 | 248 |
| 251 /** | 249 /** |
| 252 * Error thrown when a runtime error occurs. | 250 * Error thrown when a runtime error occurs. |
| 253 */ | 251 */ |
| 254 class RuntimeError implements Error { | 252 class RuntimeError implements Error { |
| 255 final message; | 253 final message; |
| 256 RuntimeError(this.message); | 254 RuntimeError(this.message); |
| 257 String toString() => "RuntimeError: $message"; | 255 String toString() => "RuntimeError: $message"; |
| 258 } | 256 } |
| OLD | NEW |