Skip to content

Commit

Permalink
新增通过 Throwable 方式构建失败请求.
Browse files Browse the repository at this point in the history
  • Loading branch information
magestacks committed Nov 18, 2021
1 parent fd4cb46 commit fb14417
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public static <T> Result<T> failure(ServiceException serviceException) {
.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)
Expand Down

0 comments on commit fb14417

Please sign in to comment.