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