OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Errors are created and thrown by DartVM only. | 4 // Errors are created and thrown by DartVM only. |
5 // Changes here should also be reflected in corelib/error.dart as well | 5 // Changes here should also be reflected in corelib/error.dart as well |
6 | 6 |
7 class AssertError { | 7 class AssertionError { |
8 factory AssertError._uninstantiable() { | 8 factory AssertionError._uninstantiable() { |
9 throw const UnsupportedOperationException( | 9 throw const UnsupportedOperationException( |
10 "AssertError can only be allocated by the VM"); | 10 "AssertionError can only be allocated by the VM"); |
11 } | 11 } |
12 static throwNew(int assertionStart, int assertionEnd) | 12 static throwNew(int assertionStart, int assertionEnd) |
13 native "AssertError_throwNew"; | 13 native "AssertionError_throwNew"; |
14 String toString() { | 14 String toString() { |
15 return "Failed assertion: '$failedAssertion' is not true " + | 15 return "Failed assertion: '$failedAssertion' is not true " + |
16 "in $url at line $line, column $column."; | 16 "in $url at line $line, column $column."; |
17 } | 17 } |
18 final String failedAssertion; | 18 final String failedAssertion; |
19 final String url; | 19 final String url; |
20 final int line; | 20 final int line; |
21 final int column; | 21 final int column; |
22 } | 22 } |
23 | 23 |
24 class TypeError extends AssertError { | 24 class TypeError extends AssertionError { |
25 factory TypeError._uninstantiable() { | 25 factory TypeError._uninstantiable() { |
26 throw const UnsupportedOperationException( | 26 throw const UnsupportedOperationException( |
27 "TypeError can only be allocated by the VM"); | 27 "TypeError can only be allocated by the VM"); |
28 } | 28 } |
29 String toString() { | 29 String toString() { |
30 return "Failed type check: type $srcType is not assignable to type " + | 30 return "Failed type check: type $srcType is not assignable to type " + |
31 "$dstType of $dstName in $url at line " + | 31 "$dstType of $dstName in $url at line " + |
32 "$line, column $column."; | 32 "$line, column $column."; |
33 } | 33 } |
34 final String srcType; | 34 final String srcType; |
(...skipping 12 matching lines...) Expand all Loading... |
47 } | 47 } |
48 final String url; | 48 final String url; |
49 final int line; | 49 final int line; |
50 } | 50 } |
51 | 51 |
52 class InternalError { | 52 class InternalError { |
53 const InternalError(this._msg); | 53 const InternalError(this._msg); |
54 String toString() => "InternalError: '${_msg}'"; | 54 String toString() => "InternalError: '${_msg}'"; |
55 final String _msg; | 55 final String _msg; |
56 } | 56 } |
OLD | NEW |