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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 String toString() { | 140 String toString() { |
141 if (functionName == null) { | 141 if (functionName == null) { |
142 return exceptionName; | 142 return exceptionName; |
143 } else { | 143 } else { |
144 return "$exceptionName : method: '$functionName'\n" | 144 return "$exceptionName : method: '$functionName'\n" |
145 "Receiver: null\n" | 145 "Receiver: null\n" |
146 "Arguments: $arguments"; | 146 "Arguments: $arguments"; |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 String get exceptionName() => "NullPointerException"; | 150 String get exceptionName => "NullPointerException"; |
151 | 151 |
152 final String functionName; | 152 final String functionName; |
153 final List arguments; | 153 final List arguments; |
154 } | 154 } |
155 | 155 |
156 | 156 |
157 class NoMoreElementsException implements Exception { | 157 class NoMoreElementsException implements Exception { |
158 const NoMoreElementsException(); | 158 const NoMoreElementsException(); |
159 String toString() => "NoMoreElementsException"; | 159 String toString() => "NoMoreElementsException"; |
160 } | 160 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 196 } |
197 | 197 |
198 /** | 198 /** |
199 * Exception thrown when a runtime error occurs. | 199 * Exception thrown when a runtime error occurs. |
200 */ | 200 */ |
201 class RuntimeError implements Exception { | 201 class RuntimeError implements Exception { |
202 final message; | 202 final message; |
203 RuntimeError(this.message); | 203 RuntimeError(this.message); |
204 String toString() => "RuntimeError: $message"; | 204 String toString() => "RuntimeError: $message"; |
205 } | 205 } |
OLD | NEW |