All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.styra.opa.openapi.models.errors.SDKError Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
/* 
 * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
 */

package com.styra.opa.openapi.models.errors;

import java.net.http.HttpResponse;
import java.io.InputStream;
import com.styra.opa.openapi.utils.Utils;

/**
 * Thrown by a service call when an error response occurs. Contains details about the response.
 */
@SuppressWarnings("serial")
public class SDKError extends Exception {

    private final HttpResponse rawResponse;
    private final int code;
    private final String message;
    private final byte[] body;

    public SDKError(
            HttpResponse rawResponse,
            int code,
            String message,
            byte[] body) {
        Utils.checkNotNull(rawResponse, "rawResponse");
        Utils.checkNotNull(message, "message");
        Utils.checkNotNull(body, "body");
        this.rawResponse = rawResponse;
        this.code = code;
        this.message = message;
        this.body = body;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SDKError other = (SDKError) o;
        return 
            java.util.Objects.deepEquals(this.rawResponse, other.rawResponse) &&
            java.util.Objects.deepEquals(this.code, other.code) &&
            java.util.Objects.deepEquals(this.message, other.message) &&
            java.util.Objects.deepEquals(this.body, other.body);
    }
    
    @Override
    public int hashCode() {
        return java.util.Objects.hash(
            rawResponse,
            code,
            message,
            body);
    }
    
    @Override
    public String toString() {
        return Utils.toString(SDKError.class,
                "rawResponse", rawResponse,
                "code", code,
                "message", message,
                "body", body);
    }

    public HttpResponse rawResponse() {
        return this.rawResponse;
    }

    public int code() {
        return this.code;
    }

    public String message() {
        return this.message;
    }

    public byte[] body() {
        return this.body;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy