Skip to content

Commit

Permalink
feat: GlobalExceptionHandler에서 Exception 반환값 변경 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeong-hyeok committed Aug 15, 2023
1 parent ee3de28 commit 64415b3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
public class GlobalExceptionHandler {

@ExceptionHandler
public ResponseEntity<String> handle(final Exception e) {
public ResponseEntity<ErrorResponse> handle(final Exception e) {
log.error("Internal Error occurred", e);
return ResponseEntity.internalServerError().body(e.getMessage());
return ResponseEntity.internalServerError().body(ErrorResponse.of(500, e.getMessage()));
}

@ExceptionHandler
Expand All @@ -29,4 +29,5 @@ public ResponseEntity<ErrorResponse> handle(final TokenException e) {
log.info("Invalid Token: {}", e);
return ResponseEntity.status(e.getCode()).body(ErrorResponse.of(e.getCode(), e.getMessage()));
}

}

0 comments on commit 64415b3

Please sign in to comment.