feat:模块名称调整
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.tiesheng.util.exception;
|
||||
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
|
||||
/**
|
||||
* @author huang
|
||||
* @ProjectName health
|
||||
* @Copyright Hangzhou ShuoChuang Technology Co.,Ltd All Right Reserved
|
||||
* @Description 这里是对文件的描述
|
||||
* @data 2017/8/8
|
||||
* @note 这里写文件的详细功能和改动
|
||||
* @note
|
||||
*/
|
||||
public class ApiException extends RuntimeException {
|
||||
|
||||
private ApiResp<String> apiResp;
|
||||
|
||||
public ApiException(String message) {
|
||||
super(message);
|
||||
this.apiResp = ApiResp.respCust(102, message);
|
||||
}
|
||||
|
||||
public ApiException(int code, String message) {
|
||||
this.apiResp = ApiResp.respCust(code, message);
|
||||
}
|
||||
|
||||
public ApiException(ApiResp<String> apiResp) {
|
||||
this.apiResp = apiResp;
|
||||
}
|
||||
|
||||
public ApiResp<String> getApiResp() {
|
||||
return apiResp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.tiesheng.util.exception;
|
||||
|
||||
/**
|
||||
* 异常
|
||||
*
|
||||
* @author hao
|
||||
*/
|
||||
|
||||
public enum ApiRespEnum {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 200
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
OK(200, "请求成功"),
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 400
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BadRequest(400, ""),
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 500
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ServerError(500, "服务器忙,请稍后再试"),
|
||||
|
||||
;
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
ApiRespEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user