target fix
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user