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 patch class Error { | 5 patch class Error { |
6 /* patch */ static String _objectToString(Object object) { | 6 /* patch */ static String _objectToString(Object object) { |
7 return Object._toString(object); | 7 return Object._toString(object); |
8 } | 8 } |
9 | 9 |
10 /* patch */ StackTrace get stackTrace => _stackTrace; | 10 /* patch */ StackTrace get stackTrace => _stackTrace; |
11 | 11 |
12 StackTrace _stackTrace; | 12 StackTrace _stackTrace; |
13 } | 13 } |
14 | 14 |
15 patch class AssertionError extends Error { | 15 patch class AssertionError extends Error { |
16 AssertionError._create( | 16 AssertionError._create( |
17 this._failedAssertion, this._url, this._line, this._column); | 17 this._failedAssertion, this._url, this._line, this._column); |
18 | 18 |
19 static _throwNew(int assertionStart, int assertionEnd) | 19 static _throwNew(int assertionStart, int assertionEnd) |
20 native "AssertionError_throwNew"; | 20 native "AssertionError_throwNew"; |
21 | 21 |
22 String toString() { | 22 String toString() { |
23 return "'$_url': Failed assertion: line $_line pos $_column: " | 23 var columnInfo = ""; |
| 24 if (_column > 0) { |
| 25 // Only add column information if it is valid. |
| 26 columnInfo = " pos $_column"; |
| 27 } |
| 28 return "'$_url': Failed assertion: line $_line$columnInfo: " |
24 "'$_failedAssertion' is not true."; | 29 "'$_failedAssertion' is not true."; |
25 } | 30 } |
26 final String _failedAssertion; | 31 final String _failedAssertion; |
27 final String _url; | 32 final String _url; |
28 final int _line; | 33 final int _line; |
29 final int _column; | 34 final int _column; |
30 } | 35 } |
31 | 36 |
32 patch class TypeError extends AssertionError { | 37 patch class TypeError extends AssertionError { |
33 TypeError._create(String url, int line, int column, | 38 TypeError._create(String url, int line, int column, |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 return msg_buf.toString(); | 309 return msg_buf.toString(); |
305 } | 310 } |
306 } | 311 } |
307 | 312 |
308 class _JavascriptIntegerOverflowError extends Error { | 313 class _JavascriptIntegerOverflowError extends Error { |
309 final Object _value; | 314 final Object _value; |
310 | 315 |
311 _JavascriptIntegerOverflowError(this._value); | 316 _JavascriptIntegerOverflowError(this._value); |
312 String toString() => "Javascript Integer Overflow: $_value"; | 317 String toString() => "Javascript Integer Overflow: $_value"; |
313 } | 318 } |
OLD | NEW |