| 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 * Defaults to an implementation that only carries a simple message. | 9 * Defaults to an implementation that only carries a simple message. |
| 10 */ | 10 */ |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * Creates a new FormatException with an optional error [message]. | 75 * Creates a new FormatException with an optional error [message]. |
| 76 */ | 76 */ |
| 77 const FormatException([this.message = ""]); | 77 const FormatException([this.message = ""]); |
| 78 | 78 |
| 79 String toString() => "FormatException: $message"; | 79 String toString() => "FormatException: $message"; |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 class WrongArgumentCountException implements Exception { | |
| 84 const WrongArgumentCountException(); | |
| 85 String toString() => "WrongArgumentCountException"; | |
| 86 } | |
| 87 | |
| 88 | |
| 89 class NullPointerException implements Exception { | 83 class NullPointerException implements Exception { |
| 90 const NullPointerException([this.functionName, this.arguments = const []]); | 84 const NullPointerException([this.functionName, this.arguments = const []]); |
| 91 String toString() { | 85 String toString() { |
| 92 if (functionName == null) { | 86 if (functionName == null) { |
| 93 return exceptionName; | 87 return exceptionName; |
| 94 } else { | 88 } else { |
| 95 return "$exceptionName : method: '$functionName'\n" | 89 return "$exceptionName : method: '$functionName'\n" |
| 96 "Receiver: null\n" | 90 "Receiver: null\n" |
| 97 "Arguments: $arguments"; | 91 "Arguments: $arguments"; |
| 98 } | 92 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 141 } |
| 148 | 142 |
| 149 /** | 143 /** |
| 150 * Exception thrown when a runtime error occurs. | 144 * Exception thrown when a runtime error occurs. |
| 151 */ | 145 */ |
| 152 class RuntimeError implements Exception { | 146 class RuntimeError implements Exception { |
| 153 final message; | 147 final message; |
| 154 RuntimeError(this.message); | 148 RuntimeError(this.message); |
| 155 String toString() => "RuntimeError: $message"; | 149 String toString() => "RuntimeError: $message"; |
| 156 } | 150 } |
| OLD | NEW |