| 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 part of dart.async; | 5 part of dart.async; |
| 6 | 6 |
| 7 final Expando _stackTraceExpando = new Expando("asynchronous error"); | 7 final Expando _stackTraceExpando = new Expando("asynchronous error"); |
| 8 | 8 |
| 9 void _attachStackTrace(o, st) { | 9 void _attachStackTrace(o, st) { |
| 10 if (o == null || o is bool || o is num || o is String) return; | 10 if (o == null || o is bool || o is num || o is String) return; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 Function _registerErrorHandler(Function errorHandler, Zone zone) { | 23 Function _registerErrorHandler(Function errorHandler, Zone zone) { |
| 24 if (errorHandler is ZoneBinaryCallback) { | 24 if (errorHandler is ZoneBinaryCallback) { |
| 25 return zone.registerBinaryCallback(errorHandler); | 25 return zone.registerBinaryCallback(errorHandler); |
| 26 } else { | 26 } else { |
| 27 return zone.registerUnaryCallback(errorHandler); | 27 return zone.registerUnaryCallback(errorHandler); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * *This is an experimental API.* | 32 * *DEPRECATED*. Use explicit stack trace arguments instead. |
| 33 * | 33 * |
| 34 * Get the [StackTrace] attached to [o]. | 34 * Get the [StackTrace] attached to [o]. |
| 35 * | 35 * |
| 36 * If object [o] was thrown and caught in a dart:async method, a [StackTrace] | 36 * If object [o] was thrown and caught in a dart:async method, a [StackTrace] |
| 37 * object was attached to it. Use [getAttachedStackTrace] to get that object. | 37 * object was attached to it. Use [getAttachedStackTrace] to get that object. |
| 38 * | 38 * |
| 39 * Returns [null] if no [StackTrace] was attached. | 39 * Returns [null] if no [StackTrace] was attached. |
| 40 */ | 40 */ |
| 41 @deprecated |
| 41 getAttachedStackTrace(o) { | 42 getAttachedStackTrace(o) { |
| 42 if (o == null || o is bool || o is num || o is String) return null; | 43 if (o == null || o is bool || o is num || o is String) return null; |
| 43 return _stackTraceExpando[o]; | 44 return _stackTraceExpando[o]; |
| 44 } | 45 } |
| 45 | 46 |
| 46 class _AsyncError implements Error { | 47 class _AsyncError implements Error { |
| 47 final error; | 48 final error; |
| 48 final StackTrace stackTrace; | 49 final StackTrace stackTrace; |
| 49 | 50 |
| 50 _AsyncError(this.error, this.stackTrace); | 51 _AsyncError(this.error, this.stackTrace); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 70 | 71 |
| 71 String toString() { | 72 String toString() { |
| 72 String result = "Uncaught Error: ${error}"; | 73 String result = "Uncaught Error: ${error}"; |
| 73 | 74 |
| 74 if (stackTrace != null) { | 75 if (stackTrace != null) { |
| 75 result += "\nStack Trace:\n$stackTrace"; | 76 result += "\nStack Trace:\n$stackTrace"; |
| 76 } | 77 } |
| 77 return result; | 78 return result; |
| 78 } | 79 } |
| 79 } | 80 } |
| OLD | NEW |