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

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

Issue 11275042: Renaming IndexOutOfRangeException to RangeError. (Closed) Base URL: http://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 // Exceptions are thrown either by the VM or from Dart code. 5 // Exceptions are thrown either by the VM or from Dart code.
6 6
7 /** 7 /**
8 * Interface implemented by all core library exceptions. 8 * Interface implemented by all core library exceptions.
9 * Defaults to an implementation that only carries a simple message. 9 * Defaults to an implementation that only carries a simple message.
10 */ 10 */
11 interface Exception default _ExceptionImplementation { 11 interface Exception default _ExceptionImplementation {
12 // TODO(lrn): This should be an abstract class, but we don't yet support 12 // TODO(lrn): This should be an abstract class, but we don't yet support
13 // redirecting factory constructors. 13 // redirecting factory constructors.
14 const Exception([var message]); 14 const Exception([var message]);
15 } 15 }
16 16
17 17
18 /** Default implementation of [Exception] which carries a message. */ 18 /** Default implementation of [Exception] which carries a message. */
19 class _ExceptionImplementation implements Exception { 19 class _ExceptionImplementation implements Exception {
20 final message; 20 final message;
21 const _ExceptionImplementation([this.message]); 21 const _ExceptionImplementation([this.message]);
22 String toString() => (message == null) ? "Exception" : "Exception: $message"; 22 String toString() => (message == null) ? "Exception" : "Exception: $message";
23 } 23 }
24 24
25 25
26 /** 26 /**
27 * Exception thrown because of an index outside of the valid range.
28 */
29 class IndexOutOfRangeException implements Exception {
30 const IndexOutOfRangeException(this._value);
31
32 String toString() => "IndexOutOfRangeException: $_value";
33
34 final _value;
35 }
36
37
38 /**
39 * Exception thrown when a string or some other data does not have an expected 27 * Exception thrown when a string or some other data does not have an expected
40 * format and cannot be parsed or processed. 28 * format and cannot be parsed or processed.
41 */ 29 */
42 class FormatException implements Exception { 30 class FormatException implements Exception {
43 /** 31 /**
44 * A message describing the format error. 32 * A message describing the format error.
45 */ 33 */
46 final String message; 34 final String message;
47 35
48 /** 36 /**
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 96 }
109 97
110 /** 98 /**
111 * Exception thrown when a runtime error occurs. 99 * Exception thrown when a runtime error occurs.
112 */ 100 */
113 class RuntimeError implements Exception { 101 class RuntimeError implements Exception {
114 final message; 102 final message;
115 RuntimeError(this.message); 103 RuntimeError(this.message);
116 String toString() => "RuntimeError: $message"; 104 String toString() => "RuntimeError: $message";
117 } 105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698