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 class Error { | 5 class Error { |
6 const Error(); | 6 const Error(); |
7 } | 7 } |
8 | 8 |
9 /** | 9 /** |
10 * Error thrown by the runtime system when an assert statement fails. | 10 * Error thrown by the runtime system when an assert statement fails. |
11 */ | 11 */ |
12 class AssertionError implements Error { | 12 class AssertionError implements Error { |
13 } | 13 } |
14 | 14 |
15 /** | 15 /** |
16 * Error thrown by the runtime system when a type assertion fails. | 16 * Error thrown by the runtime system when a type assertion fails. |
17 */ | 17 */ |
18 class TypeError implements AssertionError { | 18 class TypeError implements AssertionError { |
19 } | 19 } |
20 | 20 |
21 /** | 21 /** |
22 * Error thrown by the runtime system when a cast operation fails. | 22 * Error thrown by the runtime system when a cast operation fails. |
23 */ | 23 */ |
24 class CastError implements Error { | 24 class CastError implements Error { |
25 } | 25 } |
26 | 26 |
27 /** | 27 /** |
28 * Error thrown when attempting to throw [:null:]. | |
29 */ | |
30 class NullThrownError implements Error { | |
31 const NullThrownError(); | |
32 String toString() => "Throw of null."; | |
33 } | |
34 | |
35 /** | |
36 * Error thrown when a function is passed an unacceptable argument. | 28 * Error thrown when a function is passed an unacceptable argument. |
37 */ | 29 */ |
38 class ArgumentError implements Error { | 30 class ArgumentError implements Error { |
39 final message; | 31 final message; |
40 | 32 |
41 /** The [message] describes the erroneous argument. */ | 33 /** The [message] describes the erroneous argument. */ |
42 ArgumentError([this.message]); | 34 const ArgumentError([this.message]); |
43 | 35 |
44 String toString() { | 36 String toString() { |
45 if (message != null) { | 37 if (message != null) { |
46 return "Illegal argument(s): $message"; | 38 return "Illegal argument(s): $message"; |
47 } | 39 } |
48 return "Illegal argument(s)"; | 40 return "Illegal argument(s)"; |
49 } | 41 } |
50 } | 42 } |
51 | 43 |
52 /** | 44 /** |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 224 |
233 class OutOfMemoryError implements Error { | 225 class OutOfMemoryError implements Error { |
234 const OutOfMemoryError(); | 226 const OutOfMemoryError(); |
235 String toString() => "Out of Memory"; | 227 String toString() => "Out of Memory"; |
236 } | 228 } |
237 | 229 |
238 class StackOverflowError implements Error { | 230 class StackOverflowError implements Error { |
239 const StackOverflowError(); | 231 const StackOverflowError(); |
240 String toString() => "Stack Overflow"; | 232 String toString() => "Stack Overflow"; |
241 } | 233 } |
OLD | NEW |