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

Unified Diff: pkg/http/lib/src/io_client.dart

Issue 216603010: Rip out dart:io from pkg/http wherever possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 9 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 | « pkg/http/lib/src/exception.dart ('k') | pkg/http/lib/src/multipart_file.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
});
}
« no previous file with comments | « pkg/http/lib/src/exception.dart ('k') | pkg/http/lib/src/multipart_file.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698