| 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 // 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 AssertionError { | 7 class AssertionError { |
| 8 factory AssertionError._uninstantiable() { | 8 factory AssertionError._uninstantiable() { |
| 9 throw const UnsupportedOperationException( | 9 throw const UnsupportedOperationException( |
| 10 "AssertionError can only be allocated by the VM"); | 10 "AssertionError can only be allocated by the VM"); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 str = "${str}malformed type used."; | 41 str = "${str}malformed type used."; |
| 42 } | 42 } |
| 43 return str; | 43 return str; |
| 44 } | 44 } |
| 45 final String srcType; | 45 final String srcType; |
| 46 final String dstType; | 46 final String dstType; |
| 47 final String dstName; | 47 final String dstName; |
| 48 final String malformedError; | 48 final String malformedError; |
| 49 } | 49 } |
| 50 | 50 |
| 51 class CastException extends TypeError { |
| 52 factory CastException._uninstantiable() { |
| 53 throw const UnsupportedOperationException( |
| 54 "CastException can only be allocated by the VM"); |
| 55 } |
| 56 // A CastException is allocated by TypeError._throwNew() with "type cast" as |
| 57 // dst_name. |
| 58 String toString() { |
| 59 String str = (malformedError != null) ? malformedError : ""; |
| 60 if ((dstName != null) && (dstName.length > 0)) { |
| 61 str = "${str}type '$srcType' is not a subtype of " |
| 62 "type '$dstType' in type cast."; |
| 63 } else { |
| 64 str = "${str}malformed type used in type cast."; |
| 65 } |
| 66 return str; |
| 67 } |
| 68 } |
| 69 |
| 51 class FallThroughError { | 70 class FallThroughError { |
| 52 factory FallThroughError._uninstantiable() { | 71 factory FallThroughError._uninstantiable() { |
| 53 throw const UnsupportedOperationException( | 72 throw const UnsupportedOperationException( |
| 54 "FallThroughError can only be allocated by the VM"); | 73 "FallThroughError can only be allocated by the VM"); |
| 55 } | 74 } |
| 56 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; | 75 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; |
| 57 String toString() { | 76 String toString() { |
| 58 return "'$url': Switch case fall-through at line $line."; | 77 return "'$url': Switch case fall-through at line $line."; |
| 59 } | 78 } |
| 60 final String url; | 79 final String url; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 77 String toString() => "Unresolved static method: url '$url' line $line " | 96 String toString() => "Unresolved static method: url '$url' line $line " |
| 78 "pos $column\n$failedResolutionLine\n"; | 97 "pos $column\n$failedResolutionLine\n"; |
| 79 | 98 |
| 80 static _throwNew(int token_pos) native "StaticResolutionException_throwNew"; | 99 static _throwNew(int token_pos) native "StaticResolutionException_throwNew"; |
| 81 | 100 |
| 82 final String failedResolutionLine; | 101 final String failedResolutionLine; |
| 83 final String url; | 102 final String url; |
| 84 final int line; | 103 final int line; |
| 85 final int column; | 104 final int column; |
| 86 } | 105 } |
| OLD | NEW |