com.lx.util.exception.ResultServiceException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lxboot3 Show documentation
Show all versions of lxboot3 Show documentation
使用文档: https://a7fi97h1rc.feishu.cn/docx/X3LRdtLhkoXQ8hxgXDQc2CLOnEg?from=from_copylink
package com.lx.util.exception;
/**
* 指定返回code 的异常
* @author 86158
*/
public class ResultServiceException extends ServiceException {
/** 状态码*/
private int statusCode;
/** 给前台返回的数据*/
private Object data;
public static void exMsg(String msg){
throw new ResultServiceException(msg);
}
//说明: 抛出异常
/**{ ylx } 2020/9/21 17:11 */
public static void exMsg(String msg, int statusCode){
throw new ResultServiceException(msg, statusCode);
}
public ResultServiceException(Throwable e, int statusCode) {
super(e);
this.statusCode = statusCode;
}
public ResultServiceException(String msg) {
super(msg);
this.statusCode = 50000;
}
public ResultServiceException(String msg, int statusCode) {
super(msg);
this.statusCode = statusCode;
}
public ResultServiceException(String msg, Object data, int statusCode) {
super(msg);
this.data = data;
this.statusCode = statusCode;
}
//说明: 获取状态码
/**{ ylx } 2020/9/21 17:09 */
public int getStatusCode(){
return statusCode;
}
//获取返回的数据
public Object getData(){
return data;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy