public ErrorType mapNettyToOutboundErrorType()

in zuul-core/src/main/java/com/netflix/zuul/netty/NettyRequestAttemptFactory.java [36:72]


    public ErrorType mapNettyToOutboundErrorType(Throwable t) {
        if (t instanceof ReadTimeoutException) {
            return OutboundErrorType.READ_TIMEOUT;
        }

        if (t instanceof OriginConcurrencyExceededException) {
            return OutboundErrorType.ORIGIN_CONCURRENCY_EXCEEDED;
        }

        if (t instanceof OriginConnectException) {
            return ((OriginConnectException) t).getErrorType();
        }

        if (t instanceof OutboundException) {
            return ((OutboundException) t).getOutboundErrorType();
        }

        if (t instanceof Errors.NativeIoException
                && ((Errors.NativeIoException) t).expectedErr() == Errors.ERRNO_ECONNRESET_NEGATIVE) {
            // This is a "Connection reset by peer" which we see fairly often happening when Origin servers are
            // overloaded.
            LOG.warn("ERRNO_ECONNRESET_NEGATIVE mapped to RESET_CONNECTION", t);
            return OutboundErrorType.RESET_CONNECTION;
        }

        if (t instanceof ClosedChannelException) {
            return OutboundErrorType.RESET_CONNECTION;
        }

        Throwable cause = t.getCause();
        if (cause instanceof IllegalStateException && cause.getMessage().contains("server")) {
            LOG.warn("IllegalStateException mapped to NO_AVAILABLE_SERVERS", cause);
            return OutboundErrorType.NO_AVAILABLE_SERVERS;
        }

        return OutboundErrorType.OTHER;
    }