target fix

This commit is contained in:
arys
2026-04-02 19:38:58 +05:00
parent a47fe1cce9
commit 605b192381
2 changed files with 12 additions and 0 deletions
+5
View File
@@ -42,6 +42,11 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.web.servlet.resource.NoResourceFoundException;
@RestControllerAdvice
public class GlobalExceptionHandler {
@@ -44,6 +45,12 @@ public class GlobalExceptionHandler {
return ResponseEntity.badRequest().body(body);
}
@ExceptionHandler(NoResourceFoundException.class)
public ResponseEntity<Map<String, Object>> handleNoResourceFound(NoResourceFoundException e) {
logger.warn("Resource not found: {}", e.getResourcePath());
return ResponseEntity.status(404).body(errorBody("NOT_FOUND", "Resource not found"));
}
@ExceptionHandler(Exception.class)
public ResponseEntity<Map<String, Object>> handleGeneral(Exception e) {
logger.error("Unexpected error", e);