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

com.github.dekobon.http.CloudApiRemoteServerError Maven / Gradle / Ivy

package com.github.dekobon.http;

import com.github.dekobon.exceptions.CloudApiIOException;
import org.apache.http.HttpResponse;

class CloudApiRemoteServerError extends CloudApiIOException {
    private final HttpResponse response;

    CloudApiRemoteServerError(final HttpResponse response) {
        super(buildMessage(response));
        this.response = response;
    }

    CloudApiRemoteServerError(final HttpResponse response, final Exception cause) {
        super(buildMessage(response), cause);
        this.response = response;
    }

    private static String buildMessage(final HttpResponse response) {
        return String.format("Remote server error [%d] - %s. "
                + "Request Details:\n%s"
                + "Response Details:\n%s",
                response.getStatusLine().getStatusCode(),
                response.getStatusLine().getReasonPhrase(),
                response);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy