Home / Function/ exceptionCaught() — netty Function Reference

exceptionCaught() — netty Function Reference

Architecture documentation for the exceptionCaught() function in WebSocketServerProtocolHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3d292f19_062f_1a78_4428_b018cc17faae["exceptionCaught()"]
  24d9f96e_3f70_9b0f_3941_7e5455fcbe3b["WebSocketServerProtocolHandler"]
  3d292f19_062f_1a78_4428_b018cc17faae -->|defined in| 24d9f96e_3f70_9b0f_3941_7e5455fcbe3b
  style 3d292f19_062f_1a78_4428_b018cc17faae fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerProtocolHandler.java lines 257–267

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        if (cause instanceof WebSocketHandshakeException) {
            FullHttpResponse response = new DefaultFullHttpResponse(
                    HTTP_1_1, HttpResponseStatus.BAD_REQUEST, Unpooled.wrappedBuffer(cause.getMessage().getBytes()));
            ctx.channel().writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
        } else {
            ctx.fireExceptionCaught(cause);
            ctx.close();
        }
    }

Subdomains

Frequently Asked Questions

What does exceptionCaught() do?
exceptionCaught() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerProtocolHandler.java.
Where is exceptionCaught() defined?
exceptionCaught() is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerProtocolHandler.java at line 257.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free