Index: pkg/http/lib/src/io_client.dart |
diff --git a/pkg/http/lib/src/io_client.dart b/pkg/http/lib/src/io_client.dart |
index 112607d4bfc17c06b8a8d554df28c845f2cdfdf6..b5e481528c6d3fd6d5407864a847a920b29ab6c3 100644 |
--- a/pkg/http/lib/src/io_client.dart |
+++ b/pkg/http/lib/src/io_client.dart |
@@ -11,6 +11,7 @@ import 'package:stack_trace/stack_trace.dart'; |
import 'base_client.dart'; |
import 'base_request.dart'; |
+import 'exception.dart'; |
import 'streamed_response.dart'; |
/// A `dart:io`-based HTTP client. This is the default client. |
@@ -47,7 +48,9 @@ class IOClient extends BaseClient { |
var contentLength = response.contentLength == -1 ? |
null : response.contentLength; |
return new StreamedResponse( |
- response, |
+ response.handleError((error) => |
+ throw new ClientException(error.message, error.uri), |
+ test: (error) => error is HttpException), |
response.statusCode, |
contentLength: contentLength, |
request: request, |
@@ -55,6 +58,9 @@ class IOClient extends BaseClient { |
isRedirect: response.isRedirect, |
persistentConnection: response.persistentConnection, |
reasonPhrase: response.reasonPhrase); |
+ }).catchError((error) { |
+ if (error is! HttpException) throw error; |
+ throw new ClientException(error.message, error.uri); |
}); |
} |