Index: pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart |
diff --git a/pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart b/pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart |
index e55834c167c17af2471c50152e0900de8ef1ee64..b230174eb31e8522dd994c7c6ccfd8a4f01765f1 100644 |
--- a/pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart |
+++ b/pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart |
@@ -41,12 +41,12 @@ class SafeHttpServer extends StreamView<HttpRequest> implements HttpServer { |
HttpConnectionsInfo connectionsInfo() => _inner.connectionsInfo(); |
StreamSubscription<HttpRequest> listen(void onData(HttpRequest value), |
- {void onError(error), void onDone(), |
+ {Function onError, void onDone(), |
bool cancelOnError: false}) { |
var subscription; |
subscription = super.listen((request) { |
onData(new _HttpRequestWrapper(request)); |
- }, onError: (error) { |
+ }, onError: (error, [StackTrace stackTrace]) { |
Lasse Reichstein Nielsen
2013/10/04 08:45:17
make not optional.
floitsch
2013/10/05 18:11:48
Done.
|
// Ignore socket error 104, which is caused by a request being cancelled |
// before it writes any headers. There's no reason to care about such |
// requests. |
@@ -56,7 +56,13 @@ class SafeHttpServer extends StreamView<HttpRequest> implements HttpServer { |
// Manually handle cancelOnError so the above (ignored) errors don't |
// cause unsubscription. |
if (cancelOnError) subscription.cancel(); |
- if (onError != null) onError(error); |
+ if (onError != null) { |
+ if (onError is ZoneBinaryCallback) { |
+ onError(error, stackTrace); |
+ } else { |
+ onError(error); |
+ } |
+ } |
}, onDone: onDone); |
return subscription; |
} |