BaseRuntimeException自定义业务异常类实现

public class BaseRuntimeException extends RuntimeException {
    private final int code;

    public BaseRuntimeException(StatusCode statusCode) {
        this(statusCode.getStatusCode(), statusCode.getStatusMessage());
    }

    public BaseRuntimeException(int code, String message) {
        super(message);
        this.code = code;
    }

    public int getCode() {
        return this.code;
    }
}

 

posted @ 2018-05-06 20:26  ~清风煮酒~  阅读(719)  评论(0编辑  收藏  举报