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

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

Issue 11235054: Removed IllegalAccessException and UnsupportedOperationException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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
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 class Error { 5 class Error {
6 const Error(); 6 const Error();
7 } 7 }
8 8
9 /**
10 * Error thrown by the runtime system when an assert statement fails.
11 */
9 class AssertionError implements Error { 12 class AssertionError implements Error {
10 } 13 }
11 14
15 /**
16 * Error thrown by the runtime system when a type assertion fails.
17 */
12 class TypeError implements AssertionError { 18 class TypeError implements AssertionError {
13 } 19 }
14 20
21 /**
22 * Error thrown by the runtime system when a cast operation fails.
23 */
15 class CastError implements Error { 24 class CastError implements Error {
16 } 25 }
17 26
18 /** 27 /**
19 * Error thrown when a function is passed an unacceptable argument. 28 * Error thrown when a function is passed an unacceptable argument.
20 */class ArgumentError implements Error { 29 */
30 class ArgumentError implements Error {
21 final message; 31 final message;
22 32
23 /** The [message] describes the erroneous argument. */ 33 /** The [message] describes the erroneous argument. */
24 const ArgumentError([this.message = ""]); 34 const ArgumentError([this.message = ""]);
25 35
26 String toString() { 36 String toString() {
27 if (message != null) { 37 if (message != null) {
28 return "Illegal argument(s): $message"; 38 return "Illegal argument(s): $message";
29 } 39 }
30 return "Illegal argument(s)"; 40 return "Illegal argument(s)";
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 .replaceAll('\r', '${backslash}r') 139 .replaceAll('\r', '${backslash}r')
130 .replaceAll('"', '$backslash"'); 140 .replaceAll('"', '$backslash"');
131 return '"$escaped"'; 141 return '"$escaped"';
132 } 142 }
133 return _objectToString(object); 143 return _objectToString(object);
134 } 144 }
135 145
136 external static String _objectToString(Object object); 146 external static String _objectToString(Object object);
137 } 147 }
138 148
149 /**
150 * The operation was not allowed by the current state of the object.
151 *
152 * This is a generic error used for a variety of different erroneous
153 * actions. The message should be descriptive.
154 */
155 class StateError {
156 final String message;
157 StateError(this.message);
158 String toString() => message;
159 }
160
139 161
140 class OutOfMemoryError implements Error { 162 class OutOfMemoryError implements Error {
141 const OutOfMemoryError(); 163 const OutOfMemoryError();
142 String toString() => "Out of Memory"; 164 String toString() => "Out of Memory";
143 } 165 }
144 166
145 class StackOverflowError implements Error { 167 class StackOverflowError implements Error {
146 const StackOverflowError(); 168 const StackOverflowError();
147 String toString() => "Stack Overflow"; 169 String toString() => "Stack Overflow";
148 } 170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698