Index: runtime/bin/builtin.dart |
diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart |
index 368b73ec740ef94d6ebf62d9e32edaf0ea2b6c30..9f241b18ae87284f8ab7a578bf6b1472f2506097 100644 |
--- a/runtime/bin/builtin.dart |
+++ b/runtime/bin/builtin.dart |
@@ -75,18 +75,22 @@ void _makeHttpRequest(String uri) { |
_httpRequestResponseCode = 0; |
_httpRequestStatusString = null; |
_httpRequestResponse = null; |
- Uri requestUri = Uri.parse(uri); |
- _client.getUrl(requestUri) |
- .then((HttpClientRequest request) => request.close()) |
- .then((HttpClientResponse response) { |
- return response |
- .fold(new BytesBuilder(), (b, d) => b..add(d)) |
- .then((builder) { |
- _requestCompleted(builder.takeBytes(), response); |
- }); |
- }).catchError((error) { |
- _requestFailed(error); |
- }); |
+ try { |
+ Uri requestUri = Uri.parse(uri); |
+ _client.getUrl(requestUri) |
+ .then((HttpClientRequest request) => request.close()) |
+ .then((HttpClientResponse response) { |
+ return response |
+ .fold(new BytesBuilder(), (b, d) => b..add(d)) |
+ .then((builder) { |
+ _requestCompleted(builder.takeBytes(), response); |
+ }); |
+ }).catchError((error) { |
+ _requestFailed(error); |
+ }); |
+ } catch (error) { |
+ _requestFailed(error); |
+ } |
} |