Skip to content

Commit

Permalink
[feat] add global exception handler
Browse files Browse the repository at this point in the history
  • Loading branch information
kgy1008 committed Jul 10, 2024
1 parent e09b400 commit 7b6cb97
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.hankki.hankkiserver.api.dto.HankkiResponse;
import org.hankki.hankkiserver.common.code.BusinessErrorCode;
import org.hankki.hankkiserver.common.exception.BadRequestException;
import org.hankki.hankkiserver.common.exception.ConflictException;
import org.hankki.hankkiserver.common.exception.NotFoundException;
import org.hankki.hankkiserver.common.exception.UnauthorizedException;

Expand Down Expand Up @@ -32,6 +33,12 @@ public HankkiResponse<Void> handleEntityNotFoundException(NotFoundException e) {
return HankkiResponse.fail(e.getErrorCode());
}

@ExceptionHandler(ConflictException.class)
public HankkiResponse<Void> handleConflictException(ConflictException e) {
log.error("handleConflictException() in GlobalExceptionHandler throw ConflictException : {}", e.getMessage());
return HankkiResponse.fail(e.getErrorCode());
}

@ExceptionHandler(Exception.class)
public HankkiResponse<Void> handleException(Exception e) {
log.error("handleException() in GlobalExceptionHandler throw Exception : {}", e.getMessage());
Expand Down

0 comments on commit 7b6cb97

Please sign in to comment.