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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 String get exceptionName => "NullPointerException"; | 57 String get exceptionName => "NullPointerException"; |
58 | 58 |
59 final String functionName; | 59 final String functionName; |
60 final List arguments; | 60 final List arguments; |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 class NotImplementedException implements Exception { | |
65 const NotImplementedException([String message]) : this._message = message; | |
66 String toString() => (this._message !== null | |
67 ? "NotImplementedException: $_message" | |
68 : "NotImplementedException"); | |
69 final String _message; | |
70 } | |
71 | |
72 | |
73 class IllegalJSRegExpException implements Exception { | 64 class IllegalJSRegExpException implements Exception { |
74 const IllegalJSRegExpException(String this._pattern, String this._errmsg); | 65 const IllegalJSRegExpException(String this._pattern, String this._errmsg); |
75 String toString() => "IllegalJSRegExpException: '$_pattern' '$_errmsg'"; | 66 String toString() => "IllegalJSRegExpException: '$_pattern' '$_errmsg'"; |
76 final String _pattern; | 67 final String _pattern; |
77 final String _errmsg; | 68 final String _errmsg; |
78 } | 69 } |
79 | 70 |
80 | 71 |
81 class IntegerDivisionByZeroException implements Exception { | 72 class IntegerDivisionByZeroException implements Exception { |
82 const IntegerDivisionByZeroException(); | 73 const IntegerDivisionByZeroException(); |
83 String toString() => "IntegerDivisionByZeroException"; | 74 String toString() => "IntegerDivisionByZeroException"; |
84 } | 75 } |
85 | 76 |
86 /** | 77 /** |
87 * Exception thrown when a runtime error occurs. | 78 * Exception thrown when a runtime error occurs. |
88 */ | 79 */ |
89 class RuntimeError implements Exception { | 80 class RuntimeError implements Exception { |
90 final message; | 81 final message; |
91 RuntimeError(this.message); | 82 RuntimeError(this.message); |
92 String toString() => "RuntimeError: $message"; | 83 String toString() => "RuntimeError: $message"; |
93 } | 84 } |
OLD | NEW |