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

com.gitee.cliveyuan.tools.exception.NetException Maven / Gradle / Ivy

There is a newer version: 4.0.6
Show newest version
package com.gitee.cliveyuan.tools.exception;

/**
 * 网络异常
 *
 * @author clive
 * Created on 2018/07/24
 * @since 1.0
 */
public class NetException extends BaseException {

    public NetException(int code, String message) {
        super(code, message);
    }

    public static NetException unknownHost() {
        return new NetException(1000, "Unknown Host Error");
    }

    public static NetException httpStatusError(int statusCode) {
        return new NetException(1001, "Http Status Error, statusCode:" + statusCode);
    }

    public static NetException timeout(int timeout) {
        return new NetException(1002, "Http Connect Timeout: " + timeout + " ms");
    }

    public static NetException unKnowError() {
        return new NetException(1003, "UnKnow Error");
    }

    public static NetException illegalInvokeError(String msg) {
        return new NetException(1004, "Illegal Invoke Error: " + msg);
    }

    public static NetException connectionRefused(String url) {
        return new NetException(1005, "[Connection Refused] Fail To Connect " + url);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy