Skip to content

Commit

Permalink
Don't print from server (grpc#212)
Browse files Browse the repository at this point in the history
Co-authored-by: Vyacheslav Egorov <[email protected]>
  • Loading branch information
sigurdm and mraleph authored Oct 29, 2020
1 parent 7ea15a8 commit 21529c6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/src/server/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 21529c6

Please sign in to comment.