Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: sdk/lib/core/errors.dart

Issue 11896013: Add List.reversed to give a reverse fixed-length view of a list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved some functionality to separate CL. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/collection_dev/list.dart ('k') | sdk/lib/core/list.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 class Error { 7 class Error {
8 const Error(); 8 const Error();
9 9
10 /** 10 /**
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 /** 86 /**
87 * Create a new [RangeError] with the given [message]. 87 * Create a new [RangeError] with the given [message].
88 * 88 *
89 * Temporarily made const for backwards compatibilty. 89 * Temporarily made const for backwards compatibilty.
90 */ 90 */
91 RangeError(var message) : super(message); 91 RangeError(var message) : super(message);
92 92
93 /** Create a new [RangeError] with a message for the given [value]. */ 93 /** Create a new [RangeError] with a message for the given [value]. */
94 RangeError.value(num value) : super("value $value"); 94 RangeError.value(num value) : super("value $value");
95 95
96 /** Create a new [RangeError] with a message for a value and a range. */
97 RangeError.range(num value, num start, num end)
98 : super("value $value not in range $start..$end");
99
96 String toString() => "RangeError: $message"; 100 String toString() => "RangeError: $message";
97 } 101 }
98 102
99 103
100 /** 104 /**
101 * Error thrown when control reaches the end of a switch case. 105 * Error thrown when control reaches the end of a switch case.
102 * 106 *
103 * The Dart specification requires this error to be thrown when 107 * The Dart specification requires this error to be thrown when
104 * control reaches the end of a switch case (except the last case 108 * control reaches the end of a switch case (except the last case
105 * of a switch) without meeting a break or similar end of the control 109 * of a switch) without meeting a break or similar end of the control
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 * This is a generic error used for a variety of different erroneous 235 * This is a generic error used for a variety of different erroneous
232 * actions. The message should be descriptive. 236 * actions. The message should be descriptive.
233 */ 237 */
234 class StateError implements Error { 238 class StateError implements Error {
235 final String message; 239 final String message;
236 StateError(this.message); 240 StateError(this.message);
237 String toString() => "Bad state: $message"; 241 String toString() => "Bad state: $message";
238 } 242 }
239 243
240 244
245 /**
246 * Error occurring when a collection is modified during iteration.
247 *
248 * Some modifications may be allowed for some collections, so each collection
249 * ([Iterable] or similar collection of values) should declare which operations
250 * are allowed during an iteration.
251 */
252 class ConcurrentModificationError implements Error {
253 /** The object that was modified in an incompatible way. */
254 final Object modifiedObject;
255
256 const ConcurrentModificationError([this.modifiedObject]);
257
258 String toString() {
259 if (modifiedObject == null) {
260 return "Concurrent modification during iteration.";
261 }
262 return "Concurrent modification during iteration: "
263 "${Error.safeToString(modifiedObject)}.";
264 }
265 }
266
267
241 class OutOfMemoryError implements Error { 268 class OutOfMemoryError implements Error {
242 const OutOfMemoryError(); 269 const OutOfMemoryError();
243 String toString() => "Out of Memory"; 270 String toString() => "Out of Memory";
244 } 271 }
245 272
246 class StackOverflowError implements Error { 273 class StackOverflowError implements Error {
247 const StackOverflowError(); 274 const StackOverflowError();
248 String toString() => "Stack Overflow"; 275 String toString() => "Stack Overflow";
249 } 276 }
250 277
251 /** 278 /**
252 * Error thrown when a runtime error occurs. 279 * Error thrown when a runtime error occurs.
253 */ 280 */
254 class RuntimeError implements Error { 281 class RuntimeError implements Error {
255 final message; 282 final message;
256 RuntimeError(this.message); 283 RuntimeError(this.message);
257 String toString() => "RuntimeError: $message"; 284 String toString() => "RuntimeError: $message";
258 } 285 }
OLDNEW
« no previous file with comments | « sdk/lib/collection_dev/list.dart ('k') | sdk/lib/core/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698