mirror of https://github.com/longtai-cn/hippo4j
重构服务端异常体系 #124
parent
a1d6e8a723
commit
27739d458f
@ -0,0 +1,21 @@
|
||||
package cn.hippo4j.common.web.exception;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Abstract exception.
|
||||
*
|
||||
* @author chen.ma
|
||||
* @date 2022/3/2 20:01
|
||||
*/
|
||||
public class AbstractException extends RuntimeException {
|
||||
|
||||
@Getter
|
||||
public final ErrorCode errorCode;
|
||||
|
||||
public AbstractException(String message, Throwable throwable, ErrorCode errorCode) {
|
||||
super(message, throwable);
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.hippo4j.common.web.exception;
|
||||
|
||||
/**
|
||||
* 错误码抽象接口.
|
||||
*
|
||||
* @author chen.ma
|
||||
* @date 2021/9/16 15:39
|
||||
*/
|
||||
public interface ErrorCode {
|
||||
|
||||
/**
|
||||
* 错误码.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getCode();
|
||||
|
||||
/**
|
||||
* 错误信息.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getMessage();
|
||||
|
||||
}
|
Loading…
Reference in new issue