From 1c3200b5aa47f494dd744f39b2ee2d86b9f5e2c0 Mon Sep 17 00:00:00 2001 From: JeongHun Yu Date: Thu, 20 Jul 2023 16:18:33 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20(#97)=20GlobalExceptionHandler=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=B6=94=EA=B0=80=20(#98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/votogether/exception/GlobalExceptionHandler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java b/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java index bd6241793..01447a622 100644 --- a/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java +++ b/backend/src/main/java/com/votogether/exception/GlobalExceptionHandler.java @@ -1,27 +1,32 @@ package com.votogether.exception; +import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; +@Slf4j @RestControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler public ResponseEntity handleException(final Exception e) { + log.error("[" + e.getClass() + "] : " + e.getMessage()); return ResponseEntity.internalServerError() .body(new ExceptionResponse(-9999, "알 수 없는 서버 에러가 발생했습니다.")); } @ExceptionHandler public ResponseEntity handleBadRequestException(final BadRequestException e) { + log.warn("[" + e.getClass() + "] : " + e.getMessage()); return ResponseEntity.badRequest() .body(ExceptionResponse.from(e)); } @ExceptionHandler public ResponseEntity handleNotFoundException(final NotFoundException e) { + log.warn("[" + e.getClass() + "] : " + e.getMessage()); return ResponseEntity.status(HttpStatus.NOT_FOUND) .body(ExceptionResponse.from(e)); }