Search in sources :

Example 46 with DecoderException

use of io.netty.handler.codec.DecoderException in project zuul by Netflix.

the class Http2StreamErrorHandler method exceptionCaught.

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
    if (cause instanceof StreamException) {
        StreamException streamEx = (StreamException) cause;
        ctx.writeAndFlush(new DefaultHttp2ResetFrame(streamEx.error()));
    } else if (cause instanceof DecoderException) {
        ctx.writeAndFlush(new DefaultHttp2ResetFrame(Http2Error.PROTOCOL_ERROR));
    } else {
        super.exceptionCaught(ctx, cause);
    }
}
Also used : DecoderException(io.netty.handler.codec.DecoderException) DefaultHttp2ResetFrame(io.netty.handler.codec.http2.DefaultHttp2ResetFrame)

Aggregations

DecoderException (io.netty.handler.codec.DecoderException)46 ByteBuf (io.netty.buffer.ByteBuf)6 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)5 ClosedChannelException (java.nio.channels.ClosedChannelException)4 SSLHandshakeException (javax.net.ssl.SSLHandshakeException)4 Channel (io.netty.channel.Channel)3 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)3 Test (org.junit.jupiter.api.Test)3 ChannelInboundHandlerAdapter (io.netty.channel.ChannelInboundHandlerAdapter)2 TooLongFrameException (io.netty.handler.codec.TooLongFrameException)2 DomainNameMappingBuilder (io.netty.util.DomainNameMappingBuilder)2 IOException (java.io.IOException)2 SSLException (javax.net.ssl.SSLException)2 Test (org.junit.Test)2 Vector3d (com.flowpowered.math.vector.Vector3d)1 Vector3i (com.flowpowered.math.vector.Vector3i)1 ApiError (com.nike.backstopper.apierror.ApiError)1 ApiErrorWithMetadata (com.nike.backstopper.apierror.ApiErrorWithMetadata)1 CircuitBreakerException (com.nike.fastbreak.exception.CircuitBreakerException)1 Pair (com.nike.internal.util.Pair)1