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

Unified Diff: pkg/shelf/lib/shelf_io.dart

Issue 654933005: pkg/shelf: handle errors when parsing HttpRequest in shelf_io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/shelf/lib/shelf_io.dart
diff --git a/pkg/shelf/lib/shelf_io.dart b/pkg/shelf/lib/shelf_io.dart
index c6853025bd94d39b665d319bef3a6dbc20474c82..addc04f7d117ed8cd8b79c2bb4245e28394e0bcc 100644
--- a/pkg/shelf/lib/shelf_io.dart
+++ b/pkg/shelf/lib/shelf_io.dart
@@ -53,7 +53,13 @@ void serveRequests(Stream<HttpRequest> requests, Handler handler) {
///
/// Returns a [Future] which completes when the request has been handled.
Future handleRequest(HttpRequest request, Handler handler) {
- var shelfRequest = _fromHttpRequest(request);
+ var shelfRequest;
+ try {
+ shelfRequest =_fromHttpRequest(request);
nweiz 2014/10/14 22:16:24 I'd avoid the manual try/catch by just putting thi
kevmoo 2014/11/23 00:21:19 I was trying to separate the two error cases–when
nweiz 2014/11/24 20:55:20 SGTM Add a space after "=".
kevmoo 2014/11/24 21:04:31 Done.
+ } catch (error, stackTrace) {
+ var response = _logError('Error parsing request.\n$error', stackTrace);
+ return _writeResponse(response, request.response);
+ }
// TODO(nweiz): abstract out hijack handling to make it easier to implement an
// adapter.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698