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

io.castle.client.model.CastleServerErrorException Maven / Gradle / Ivy

Go to download

Castle adds real-time monitoring of your authentication stack, instantly notifying you and your users on potential account hijacks.

There is a newer version: 2.4.3
Show newest version
package io.castle.client.model;

import io.castle.client.Castle;
import okhttp3.Response;

import java.io.IOException;

public class CastleServerErrorException extends CastleRuntimeException {

    private final int responseCode;
    private final String responseMessage;
    private String response;

    public CastleServerErrorException(Response response) {
        super(response.toString());
        
        this.responseCode = response.code();
        this.responseMessage = response.message();
        try {
            this.response = response.body().string();
        } catch (NullPointerException | IOException | IllegalStateException e) {
            Castle.logger.error("CastleServerErrorException. No response body.", e);
        }
    }

    public int getResponseCode() {
        return responseCode;
    }

    public String getResponseMessage() {
        return responseMessage;
    }

    public String getResponse() {
        return response;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy