We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 72bb153 commit 9f6d0ddCopy full SHA for 9f6d0dd
1 file changed
src/main/java/com/example/SorokinSpringBoot/exceptions/GlobalExceptionHandler.java
@@ -0,0 +1,20 @@
1
+package com.example.SorokinSpringBoot.exceptions;
2
+
3
+import org.springframework.http.ResponseEntity;
4
+import org.springframework.web.bind.annotation.ControllerAdvice;
5
+import org.springframework.web.bind.annotation.ExceptionHandler;
6
7
+import java.util.logging.Logger;
8
9
+@ControllerAdvice
10
+public class GlobalExceptionHandler {
11
12
+ private static final Logger logger = Logger.getLogger(GlobalExceptionHandler.class.getName());
13
14
+ @ExceptionHandler(Exception.class)
15
+ public ResponseEntity<Void> handleGenericException(Exception exception) {
16
+ logger.warning("Handle exception" + exception);
17
+ return ResponseEntity.status(500).build();
18
+ }
19
20
+}
0 commit comments