[File] 파비콘 없는 애러 수정

This commit is contained in:
2026-03-10 17:58:40 +09:00
parent 940d9002ea
commit 2a5d7cbc64
2 changed files with 15 additions and 0 deletions
@@ -7,6 +7,7 @@ import java.text.MessageFormat;
public enum ApiResponseCode { public enum ApiResponseCode {
// ===== Common ===== // ===== Common =====
CODE_200 ("200", "성공", HttpStatus.OK), CODE_200 ("200", "성공", HttpStatus.OK),
CODE_204 ("204", "컨텐츠 없음", HttpStatus.NO_CONTENT),
CODE_400 ("400", "잘못된 요청", HttpStatus.BAD_REQUEST), CODE_400 ("400", "잘못된 요청", HttpStatus.BAD_REQUEST),
CODE_401 ("401", "인증 필요 합니다.", HttpStatus.UNAUTHORIZED), CODE_401 ("401", "인증 필요 합니다.", HttpStatus.UNAUTHORIZED),
@@ -14,6 +14,7 @@ import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.servlet.resource.NoResourceFoundException;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
@@ -102,4 +103,17 @@ public class GlobalExceptionHandler {
return ApiResponse.entity(ApiResponseCode.CODE_500); return ApiResponse.entity(ApiResponseCode.CODE_500);
} }
@ExceptionHandler(NoResourceFoundException.class)
public ResponseEntity<ApiResponse<Void>> handleNoResourceFound(NoResourceFoundException e) {
String resourcePath = e.getResourcePath();
if ("favicon.ico".equals(resourcePath) || "/favicon.ico".equals(resourcePath)) {
return ApiResponse.entity(ApiResponseCode.CODE_204);
}
log.error("Unhandled exception occurred", e);
return ApiResponse.entity(ApiResponseCode.CODE_404);
}
} }