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

top.jfunc.http.HttpException Maven / Gradle / Ivy

package top.jfunc.http;

import top.jfunc.http.response.Response;
import top.jfunc.common.utils.MultiValueMap;

import java.util.List;
import java.util.Map;

/**
 * 1.HTTP请求异常,包括http组件内部错误-1,服务器返回错误(错误码和错误信息)
 * 2.超时异常由专门的IOException表达
 * @see Response
 * @author 熊诗言 2017/11/24
 */
public class HttpException extends RuntimeException{
    private int responseCode = -1;
    private MultiValueMap headers;

    public HttpException(int responseCode, String errorMessage , MultiValueMap headers){
        super(errorMessage);
        this.responseCode = responseCode;
        this.headers = headers;
    }
    public HttpException(int responseCode, String errorMessage){
        super(errorMessage);
        this.responseCode = responseCode;
    }
    public HttpException(String errorMessage){
        super(errorMessage);
    }
    public HttpException(Exception e){
        super(e);
    }
    public HttpException(){
    }


    public int getResponseCode() {
        return responseCode;
    }

    public Map> getHeaders() {
        return headers;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy