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 // 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 */ | 9 */ |
10 interface Exception default ExceptionImplementation { | 10 interface Exception default ExceptionImplementation { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 String toString() => "Out of Memory"; | 103 String toString() => "Out of Memory"; |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 class StackOverflowException implements Exception { | 107 class StackOverflowException implements Exception { |
108 const StackOverflowException(); | 108 const StackOverflowException(); |
109 String toString() => "Stack Overflow"; | 109 String toString() => "Stack Overflow"; |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 class BadNumberFormatException implements Exception { | 113 /** |
114 const BadNumberFormatException(String this._s); | 114 * Exception thrown when a string or some other data does not have an expected |
115 String toString() => "BadNumberFormatException: '$_s'"; | 115 * format and cannot be parsed or processed. |
116 final String _s; | 116 */ |
117 class FormatException implements Exception { | |
118 /** | |
119 * A message describing the format error. | |
120 */ | |
121 final String message; | |
Ivan Posva
2012/08/03 20:36:27
Is it intentional that you are making the message
| |
122 | |
123 /** | |
124 * Creates a new FormatException with an optional error [message]. | |
125 */ | |
126 const FormatException([this.message = ""]); | |
127 | |
128 String toString() => "FormatException: $message"; | |
117 } | 129 } |
118 | 130 |
119 | 131 |
120 class WrongArgumentCountException implements Exception { | 132 class WrongArgumentCountException implements Exception { |
121 const WrongArgumentCountException(); | 133 const WrongArgumentCountException(); |
122 String toString() => "WrongArgumentCountException"; | 134 String toString() => "WrongArgumentCountException"; |
123 } | 135 } |
124 | 136 |
125 | 137 |
126 class NullPointerException implements Exception { | 138 class NullPointerException implements Exception { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 String toString() => "IllegalJSRegExpException: '$_pattern' '$_errmsg'"; | 187 String toString() => "IllegalJSRegExpException: '$_pattern' '$_errmsg'"; |
176 final String _pattern; | 188 final String _pattern; |
177 final String _errmsg; | 189 final String _errmsg; |
178 } | 190 } |
179 | 191 |
180 | 192 |
181 class IntegerDivisionByZeroException implements Exception { | 193 class IntegerDivisionByZeroException implements Exception { |
182 const IntegerDivisionByZeroException(); | 194 const IntegerDivisionByZeroException(); |
183 String toString() => "IntegerDivisionByZeroException"; | 195 String toString() => "IntegerDivisionByZeroException"; |
184 } | 196 } |
OLD | NEW |