Don't print from server (#212)

Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
Sigurd Meldgaard 2020-10-29 12:57:47 +01:00 committed by GitHub
parent 7ea15a8160
commit 21529c6be7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -105,8 +105,10 @@ class ConnectionServer {
// timeout.
connection.incomingStreams.listen((stream) {
handler = serveStream_(stream);
}, onError: (error) {
print('Connection error: $error');
}, onError: (error, stackTrace) {
if (error is Error) {
Zone.current.handleUncaughtError(error, stackTrace);
}
}, onDone: () {
// TODO(sigurdm): This is not correct behavior in the presence of
// half-closed tcp streams.
@ -175,11 +177,11 @@ class Server extends ConnectionServer {
final connection = ServerTransportConnection.viaSocket(socket,
settings: http2ServerSettings);
serveConnection(connection);
}, onError: _printSocketError);
}
void _printSocketError(Object error) {
print('Socket error: $error');
}, onError: (error, stackTrace) {
if (error is Error) {
Zone.current.handleUncaughtError(error, stackTrace);
}
});
}
@visibleForTesting