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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 238 |
241 class OutOfMemoryError implements Error { | 239 class OutOfMemoryError implements Error { |
242 const OutOfMemoryError(); | 240 const OutOfMemoryError(); |
243 String toString() => "Out of Memory"; | 241 String toString() => "Out of Memory"; |
244 } | 242 } |
245 | 243 |
246 class StackOverflowError implements Error { | 244 class StackOverflowError implements Error { |
247 const StackOverflowError(); | 245 const StackOverflowError(); |
248 String toString() => "Stack Overflow"; | 246 String toString() => "Stack Overflow"; |
249 } | 247 } |
OLD | NEW |