netty: include pipeline on exceptions too

This commit is contained in:
Carl Mastrangelo 2019-06-27 13:04:31 -07:00 committed by GitHub
parent 1be3bd8ea4
commit 0a1805db43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -85,7 +85,8 @@ final class WriteBufferingAndExceptionHandler extends ChannelDuplexHandler {
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
assert cause != null;
Throwable previousFailure = failCause;
Status status = Utils.statusFromThrowable(cause);
Status status = Utils.statusFromThrowable(cause)
.augmentDescription("Channel Pipeline: " + ctx.pipeline().names());
failWrites(status.asRuntimeException());
// Check to see if the channel is active and this is the first failure. If a downstream
// handler triggers an exception in close(), avoid being reentrant. This is not obviously

View File

@ -285,7 +285,9 @@ public class NettyClientTransportTest {
rpc.waitForClose();
fail("expected exception");
} catch (ExecutionException ex) {
assertSame(failureStatus, ((StatusException) ex.getCause()).getStatus());
Status actual = ((StatusException) ex.getCause()).getStatus();
assertSame(failureStatus.getCode(), actual.getCode());
assertThat(actual.getDescription()).contains(failureStatus.getDescription());
}
}
@ -372,7 +374,9 @@ public class NettyClientTransportTest {
rpc.waitForClose();
fail("expected exception");
} catch (ExecutionException ex) {
assertSame(failureStatus, ((StatusException) ex.getCause()).getStatus());
Status actual = ((StatusException) ex.getCause()).getStatus();
assertSame(failureStatus.getCode(), actual.getCode());
assertThat(actual.getDescription()).contains(failureStatus.getDescription());
}
}