Skip to content

Commit

Permalink
chore: 서버 내부 오류 발생 로깅 추가 (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
pushedrumex authored Feb 27, 2024
1 parent 9149c87 commit 58982c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class ControllerAdvice {

Expand All @@ -16,6 +18,10 @@ public ResponseEntity<ErrorResponse> handleBusinessException(BusinessException e

@ExceptionHandler(Exception.class)
public ResponseEntity<ErrorResponse> handleException(Exception exception) {
String exName = exception.getClass().getSimpleName();
String exMessage = exception.getMessage();
log.error("[Exception] exName=[{}] exMessage=[{}]", exName, exMessage);

return ResponseEntity.status(INTERNAL_SERVER_ERROR).body(new ErrorResponse("알 수 없는 오류가 발생했습니다. 잠시 후 다시 시도해주세요."));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ResponseEntity<FindSimpleStoresResponse> findSimpleStores(Pageable pageab
}

@GetMapping("/stores")
public ResponseEntity<FindStoresResponse> findSimpleStores(
public ResponseEntity<FindStoresResponse> findStores(
Pageable pageable,
@RequestParam(name = "region", required = false) Region region
) {
Expand Down

0 comments on commit 58982c5

Please sign in to comment.