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; |
+} |