瀏覽代碼

异常信息

Progr1mmer 6 年之前
父節點
當前提交
68ebbf0b15
共有 1 個文件被更改,包括 6 次插入16 次删除
  1. 6 16
      common/common-web/src/main/java/com/yihu/jw/web/exception/ApiException.java

+ 6 - 16
common/common-web/src/main/java/com/yihu/jw/web/exception/ApiException.java

@ -5,26 +5,16 @@ import org.springframework.util.Assert;
public class ApiException extends RuntimeException {
    private String errorDesc; //错误消息
    private int errorCode; //错误码
    private int errorCode = -10000; //错误码
    public ApiException(String errorDesc) {
        this(errorDesc, 500);
    public ApiException(String message) {
        this(message, 500);
    }
    public ApiException(String errorDesc, int errorCode) {
        super(errorDesc);
        Assert.state(errorCode != 200, "The error code cannot be equal to 200");
        this.errorDesc = errorDesc;
    public ApiException(String message, int errorCode) {
        super(message);
        this.errorCode = errorCode;
    }
    public String getErrorDesc() {
        return errorDesc;
    }
    public int getErrorCode() {
        return errorCode;
        Assert.state(errorCode != 200, "The error code cannot be equal to 200");
    }
}