forked from plusone/plusone-commons
错误码统一进行配置,不作为异常的字段。异常通过 getType 标识不同错误类型。
This commit is contained in:
@@ -24,8 +24,6 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import xyz.zhouxy.plusone.commons.base.IWithCode;
|
||||
|
||||
/**
|
||||
* 统一结果,对返回给前端的数据进行封装。
|
||||
*
|
||||
@@ -70,10 +68,6 @@ public abstract class UnifiedResponse {
|
||||
return new ErrorResult(status, e);
|
||||
}
|
||||
|
||||
public static <E extends Throwable & IWithCode<?>> UnifiedResponse error(E e) {
|
||||
return new ErrorResult(e);
|
||||
}
|
||||
|
||||
public static UnifiedResponse of(Object status, @Nullable String message) {
|
||||
return new CustomResult(status, message);
|
||||
}
|
||||
@@ -195,10 +189,6 @@ public abstract class UnifiedResponse {
|
||||
ErrorResult(Object status, Throwable e) {
|
||||
super(status, Objects.requireNonNull(e).getMessage());
|
||||
}
|
||||
|
||||
<E extends Throwable & IWithCode<?>> ErrorResult(E e) {
|
||||
super(e.getCode(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user