Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Unified Diff: sdk/lib/async/async_error.dart

Issue 14251006: Remove AsyncError with Expando. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/dartdoc/lib/dartdoc.dart ('k') | sdk/lib/async/future.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/async_error.dart
diff --git a/sdk/lib/async/async_error.dart b/sdk/lib/async/async_error.dart
index fa90e8779b1042a31981f5ee19ed926be0b36df3..161b9ef4abfd924b1564fa32c5185b1abc7116c5 100644
--- a/sdk/lib/async/async_error.dart
+++ b/sdk/lib/async/async_error.dart
@@ -4,70 +4,14 @@
part of dart.async;
-/**
- * Error result of an asynchronous computation.
- */
-class AsyncError {
- /** The actual error thrown by the computation. */
- final error;
- /** Stack trace corresponding to the error, if available. */
- final Object stackTrace;
- /** Asynchronous error leading to this error, if error handling fails. */
- final AsyncError cause;
+final Expando _stackTraceExpando = new Expando("asynchronous error");
- // TODO(lrn): When possible, combine into one constructor with both optional
- // positional and named arguments.
- AsyncError(this.error, [this.stackTrace]): cause = null;
- AsyncError.withCause(this.error, this.stackTrace, this.cause);
-
- void _writeOn(StringSink buffer) {
- buffer.write("'");
- String message;
- try {
- message = error.toString();
- } catch (e) {
- message = Error.safeToString(error);
- }
- buffer.write(message);
- buffer.write("'\n");
- if (stackTrace != null) {
- buffer.write("Stack trace:\n");
- buffer.writeln(stackTrace.toString());
- }
- }
-
- String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.write("AsyncError: ");
- _writeOn(buffer);
- AsyncError cause = this.cause;
- while (cause != null) {
- buffer.write("Caused by: ");
- cause._writeOn(buffer);
- cause = cause.cause;
- }
- return buffer.toString();
- }
-
- throwDelayed() {
- reportError() {
- print("Uncaught Error: $error");
- if (stackTrace != null) {
- print("Stack Trace:\n$stackTrace\n");
- }
- }
-
- try {
- Timer.run(() {
- reportError();
- // TODO(floitsch): we potentially want to call the global error handler
- // directly so that we can pass the stack trace.
- throw error;
- });
- } catch (e) {
- // Unfortunately there is not much more we can do...
- reportError();
- }
- }
+void _attachStackTrace(o, st) {
+ if (o == null || o is bool || o is num || o is String) return;
+ _stackTraceExpando[o] = st;
}
+getAttachedStackTrace(o) {
+ if (o == null || o is bool || o is num || o is String) return null;
+ return _stackTraceExpando[o];
+}
« no previous file with comments | « sdk/lib/_internal/dartdoc/lib/dartdoc.dart ('k') | sdk/lib/async/future.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698