소스 검색

异常处理

Progr1mmer 6 년 전
부모
커밋
85d2029751
1개의 변경된 파일3개의 추가작업 그리고 7개의 파일을 삭제
  1. 3 7
      common/common-web/src/main/java/com/yihu/jw/web/exception/ApiException.java

+ 3 - 7
common/common-web/src/main/java/com/yihu/jw/web/exception/ApiException.java

@ -1,6 +1,8 @@
package com.yihu.jw.web.exception;
import org.springframework.util.Assert;
public class ApiException extends RuntimeException {
    private String errorDesc; //错误消息
@ -12,6 +14,7 @@ public class ApiException extends RuntimeException {
    public ApiException(String errorDesc, int errorCode) {
        super(errorDesc);
        Assert.state(errorCode != 200, "The error code cannot be equal to 200");
        this.errorDesc = errorDesc;
        this.errorCode = errorCode;
    }
@ -20,15 +23,8 @@ public class ApiException extends RuntimeException {
        return errorDesc;
    }
    public void setErrorDesc(String errorDesc) {
        this.errorDesc = errorDesc;
    }
    public int getErrorCode() {
        return errorCode;
    }
    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }
}