mirror of https://github.com/grpc/grpc-java.git
netty: include pipeline on exceptions too
This commit is contained in:
parent
1be3bd8ea4
commit
0a1805db43
|
|
@ -85,7 +85,8 @@ final class WriteBufferingAndExceptionHandler extends ChannelDuplexHandler {
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
assert cause != null;
|
assert cause != null;
|
||||||
Throwable previousFailure = failCause;
|
Throwable previousFailure = failCause;
|
||||||
Status status = Utils.statusFromThrowable(cause);
|
Status status = Utils.statusFromThrowable(cause)
|
||||||
|
.augmentDescription("Channel Pipeline: " + ctx.pipeline().names());
|
||||||
failWrites(status.asRuntimeException());
|
failWrites(status.asRuntimeException());
|
||||||
// Check to see if the channel is active and this is the first failure. If a downstream
|
// 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
|
// handler triggers an exception in close(), avoid being reentrant. This is not obviously
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,9 @@ public class NettyClientTransportTest {
|
||||||
rpc.waitForClose();
|
rpc.waitForClose();
|
||||||
fail("expected exception");
|
fail("expected exception");
|
||||||
} catch (ExecutionException ex) {
|
} 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();
|
rpc.waitForClose();
|
||||||
fail("expected exception");
|
fail("expected exception");
|
||||||
} catch (ExecutionException ex) {
|
} 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue