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

Unified Diff: utils/pub/utils.dart

Issue 11821006: Unwrap AsyncErrors to find real error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 11 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 | « utils/pub/http.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/utils.dart
diff --git a/utils/pub/utils.dart b/utils/pub/utils.dart
index b922d845d4013de9e3132acb6033f3e2e5fa86b4..544a3ce0bef5c1c9a9d99dc98154aa04694a91d3 100644
--- a/utils/pub/utils.dart
+++ b/utils/pub/utils.dart
@@ -183,3 +183,14 @@ void mapAddAll(Map destination, Map source) =>
/// replacing `+` with ` `.
String urlDecode(String encoded) =>
decodeUriComponent(encoded.replaceAll("+", " "));
+
+// TODO(rnystrom): Remove this when #7781 is fixed.
+/// When an error is rethrown in an async callback, you can end up with nested
+/// AsyncErrors. This unwraps them to find the real originating error.
+getRealError(error) {
+ while (error is AsyncError) {
+ error = error.error;
+ }
+
+ return error;
+}
« no previous file with comments | « utils/pub/http.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698