com.gitee.cliveyuan.tools.exception.NetException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-tools Show documentation
Show all versions of java-tools Show documentation
Some commonly used methods in java
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);
}
}