You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

53 lines
1.3 KiB

package cc.niushuai.bastionserver.common.exception;
import cc.niushuai.bastionserver.common.constant.CommonConstant;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* Business自定义异常
*
* @author: niushuai233
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class BusinessException extends RuntimeException {
private static final long serialVersionUID = 1L;
private int code;
private String message;
private Object[] params;
public BusinessException(String message) {
super(message);
}
public BusinessException(Throwable cause) {
super(cause);
}
public BusinessException(int code, String message) {
this.code = code;
this.message = message;
}
public BusinessException(String message, Object... params) {
super(message);
this.code = CommonConstant.INTERNAL_SERVER_ERROR_500;
this.params = params;
this.message = StrUtil.format(message, params);
}
public BusinessException(int code, String message, Object... params) {
super(message);
this.code = code;
this.params = params;
this.message = StrUtil.format(message, params);
}
public BusinessException(String message, Throwable cause) {
super(message, cause);
}
}