[File] 파비콘 없는 애러 수정
This commit is contained in:
@@ -7,6 +7,7 @@ import java.text.MessageFormat;
|
||||
public enum ApiResponseCode {
|
||||
// ===== Common =====
|
||||
CODE_200 ("200", "성공", HttpStatus.OK),
|
||||
CODE_204 ("204", "컨텐츠 없음", HttpStatus.NO_CONTENT),
|
||||
|
||||
CODE_400 ("400", "잘못된 요청", HttpStatus.BAD_REQUEST),
|
||||
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.RestControllerAdvice;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
import org.springframework.web.servlet.resource.NoResourceFoundException;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -102,4 +103,17 @@ public class GlobalExceptionHandler {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user