52 行
1.0 KiB
Java
52 行
1.0 KiB
Java
package com.weilab.biology.core.exception;
|
|
|
|
import com.weilab.biology.core.data.vo.result.ResultError;
|
|
|
|
public class BaseException extends RuntimeException {
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private int code;
|
|
|
|
private String message;
|
|
|
|
private Object data;
|
|
|
|
public BaseException(int code, String message, Object data) {
|
|
this.code = code;
|
|
this.message = message;
|
|
this.data = data;
|
|
}
|
|
|
|
public BaseException(int code, String message) {
|
|
this(code, message, null);
|
|
}
|
|
|
|
public BaseException(ResultError error) {
|
|
this(error.getCode(), error.getMessage(), null);
|
|
}
|
|
|
|
public int getCode() {
|
|
return code;
|
|
}
|
|
|
|
public void setCode(int code) {
|
|
this.code = code;
|
|
}
|
|
|
|
@Override
|
|
public String getMessage() {
|
|
return message;
|
|
}
|
|
|
|
public void setMessage(String message) {
|
|
this.message = message;
|
|
}
|
|
|
|
public Object getData() {
|
|
return data;
|
|
}
|
|
|
|
public void setData(Object data) {
|
|
this.data = data;
|
|
}
|
|
} |