kubernetes/KubernetesApiException.java

floci-io/floci · src/main/java/io/github/hectorvent/floci/services/lambda/launcher/kubernetes/KubernetesApiException.java · java · MIT
infra, Infra / DevOps

Custom exception for non‑2xx Kubernetes API responses.

// Source: https://github.com/floci-io/floci | License: MIT | Copyright 2025 Floci and its contributors
// Provided via justclaw.it.com; keep this notice with the code.
package io.github.hectorvent.floci.services.lambda.launcher.kubernetes;

/** A Kubernetes API server response outside 2xx (and, for a get, other than a plain 404). */
public class KubernetesApiException extends RuntimeException {

    private final int statusCode;

    public KubernetesApiException(String method, String path, int statusCode, String body) {
        super("Kubernetes API " + method + " " + path + " failed: HTTP " + statusCode
                + (body == null || body.isBlank() ? "" : " " + body));
        this.statusCode = statusCode;
    }

    public int getStatusCode() {
        return statusCode;
    }
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key