Chromium Code Reviews| Index: utils/pub/utils.dart |
| diff --git a/utils/pub/utils.dart b/utils/pub/utils.dart |
| index b922d845d4013de9e3132acb6033f3e2e5fa86b4..c3503316e85e88a954606b9e5a38ff9b84ed9fd0 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("+", " ")); |
| + |
| +/// 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. |
| +// TODO(rnystrom): Remove this when #7781 is fixed. |
|
nweiz
2013/01/08 23:05:13
Nit: I usually put TODOs above dartdoc comments. I
Bob Nystrom
2013/01/08 23:07:23
Done.
|
| +getRealError(error) { |
| + while (error != null && error is AsyncError) { |
|
nweiz
2013/01/08 23:05:13
"error != null" is unnecessary here. null isn't an
Bob Nystrom
2013/01/08 23:07:23
Done.
|
| + error = error.error; |
| + } |
| + |
| + return error; |
| +} |