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

no.unit.nva.auth.UnexpectedHttpResponseException Maven / Gradle / Ivy

There is a newer version: 1.41.0
Show newest version
package no.unit.nva.auth;

import java.net.http.HttpResponse;

public class UnexpectedHttpResponseException extends RuntimeException {

    public static final String UNEXPECTED_HTTP_RESPONSE_MESSAGE = "Got unexpected http response: %s %s";

    public UnexpectedHttpResponseException(int statusCode, String message) {
        super(String.format(UNEXPECTED_HTTP_RESPONSE_MESSAGE, statusCode, message));
    }

    public static UnexpectedHttpResponseException fromHttpResponse(HttpResponse httpResponse) {
        return new UnexpectedHttpResponseException(httpResponse.statusCode(), httpResponse.body().toString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy