HttpResponseException.java

package org.flasby.security;

import org.apache.hc.core5.http.impl.EnglishReasonPhraseCatalog;

/**
 * Used to map all HTTP Exceptions.
 */
public class HttpResponseException extends RuntimeException {

    static String getDefaultMessage(int httpStatusCode) {
        return ""+httpStatusCode+" - "+EnglishReasonPhraseCatalog.INSTANCE.getReason(httpStatusCode,null);
    }
    public HttpResponseException(int httpStatusCode) {
        this(getDefaultMessage(httpStatusCode));
    }

    public HttpResponseException(int httpStatusCode, Throwable cause) {
        this(getDefaultMessage(httpStatusCode), cause);
    }

    public HttpResponseException(String message) {
        super(message);
    }
    public HttpResponseException(String message, Throwable cause) {
        super(message, cause);
    }
}