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

Unified Diff: runtime/bin/builtin.dart

Issue 1001733002: - Avoid rewrapping LoadError inside LoadError. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/builtin.dart
===================================================================
--- runtime/bin/builtin.dart (revision 44402)
+++ runtime/bin/builtin.dart (working copy)
@@ -274,7 +274,7 @@
_finishedOneLoadRequest(uri);
}
-void _asyncLoadError(tag, uri, libraryUri, error) {
+void _asyncLoadError(int tag, String uri, String libraryUri, LoadError error) {
if (_logBuiltin) {
_print("_asyncLoadError($uri), error: $error");
}
@@ -283,7 +283,7 @@
// uri.
libraryUri = uri;
}
- _asyncLoadErrorCallback(uri, libraryUri, new LoadError(error.toString()));
+ _asyncLoadErrorCallback(uri, libraryUri, error);
_finishedOneLoadRequest(uri);
}
@@ -297,10 +297,15 @@
if (dataOrError is List<int>) {
_loadScript(tag, uri, libraryUri, dataOrError);
} else {
- _asyncLoadError(tag, uri, libraryUri, dataOrError);
+ assert(dataOrError is String);
+ var error = new LoadError(dataOrError.toString());
rmacnak 2015/03/11 23:50:52 toString is redundant
Ivan Posva 2015/03/11 23:53:57 Redundant, but defensive in case you are not runni
+ _asyncLoadError(tag, uri, libraryUri, error);
}
}).catchError((e) {
- _asyncLoadError(tag, uri, libraryUri, e.toString());
+ // Wrap inside a LoadError unless we are already propagating a previously
+ // seen LoadError.
+ var error = (e is LoadError) ? e : new LoadError(e.toString);
+ _asyncLoadError(tag, uri, libraryUri, error);
});
try {
@@ -311,7 +316,10 @@
if (_logBuiltin) {
_print("Exception when communicating with service isolate: $e");
}
- _asyncLoadError(tag, uri, libraryUri, e.toString());
+ // Wrap inside a LoadError unless we are already propagating a previously
+ // seen LoadError.
+ var error = (e is LoadError) ? e : new LoadError(e.toString);
+ _asyncLoadError(tag, uri, libraryUri, error);
receivePort.close();
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698