Skip to content

Commit

Permalink
add unknown exception message (#2204)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuangchong authored Jul 19, 2022
1 parent c64c00f commit 9baed60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public enum SeatunnelErrorEnum {
USER_ALREADY_EXISTS(10003, "user already exist", "The same username [%s] is exist."),
NO_SUCH_USER(10002, "no such user", "No such user. Maybe deleted by others."),
ILLEGAL_STATE(99998, "illegal state", "%s"),
UNKNOWN(99999, "unknown exception", "unknown exception")
UNKNOWN(99999, "unknown exception", "%s")
;

private final int code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ private Result<String> exceptionHandler(IllegalStateException e) {
@ExceptionHandler(value = Exception.class)
private Result<String> exceptionHandler(Exception e) {
logError(e);
return Result.failure(SeatunnelErrorEnum.UNKNOWN);
return Result.failure(SeatunnelErrorEnum.UNKNOWN, e.getMessage());
}

private void logError(Throwable throwable) {
log.error("", throwable);
log.error(throwable.getMessage(), throwable);
}

}

0 comments on commit 9baed60

Please sign in to comment.