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

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

Issue 11415028: Remove NullPointerException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed VM bugs. 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 * Safely convert a value to a [String] description. 9 * Safely convert a value to a [String] description.
10 * 10 *
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 class TypeError implements AssertionError { 43 class TypeError implements AssertionError {
44 } 44 }
45 45
46 /** 46 /**
47 * Error thrown by the runtime system when a cast operation fails. 47 * Error thrown by the runtime system when a cast operation fails.
48 */ 48 */
49 class CastError implements Error { 49 class CastError implements Error {
50 } 50 }
51 51
52 /** 52 /**
53 * Error thrown when attempting to throw [:null:].
54 */
55 class NullThrownError implements Error {
56 const NullThrownError();
57 String toString() => "Throw of null.";
58 }
59
60 /**
53 * Error thrown when a function is passed an unacceptable argument. 61 * Error thrown when a function is passed an unacceptable argument.
54 */ 62 */
55 class ArgumentError implements Error { 63 class ArgumentError implements Error {
56 final message; 64 final message;
57 65
58 /** The [message] describes the erroneous argument. */ 66 /** The [message] describes the erroneous argument. */
59 const ArgumentError([this.message]); 67 ArgumentError([this.message]);
60 68
61 String toString() { 69 String toString() {
62 if (message != null) { 70 if (message != null) {
63 return "Illegal argument(s): $message"; 71 return "Illegal argument(s): $message";
64 } 72 }
65 return "Illegal argument(s)"; 73 return "Illegal argument(s)";
66 } 74 }
67 } 75 }
68 76
69 /** 77 /**
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 238
231 class OutOfMemoryError implements Error { 239 class OutOfMemoryError implements Error {
232 const OutOfMemoryError(); 240 const OutOfMemoryError();
233 String toString() => "Out of Memory"; 241 String toString() => "Out of Memory";
234 } 242 }
235 243
236 class StackOverflowError implements Error { 244 class StackOverflowError implements Error {
237 const StackOverflowError(); 245 const StackOverflowError();
238 String toString() => "Stack Overflow"; 246 String toString() => "Stack Overflow";
239 } 247 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698