新增通过 Throwable 方式构建失败请求.

pull/10/head
chen.ma 3 years ago
parent fd4cb46158
commit fb1441708b

@ -27,6 +27,11 @@ public final class Results {
.setMessage(serviceException.getMessage());
}
public static Result<Void> failure(Throwable throwable) {
return new Result<Void>().setCode(ErrorCodeEnum.SERVICE_ERROR.getCode())
.setMessage(throwable.getMessage());
}
public static <T> Result<T> failure(String code, String message) {
return new Result<T>()
.setCode(code)

Loading…
Cancel
Save