We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1456e1 commit e50cc28Copy full SHA for e50cc28
src/main/java/com/getourguide/interview/error/ErrorHandler.java
@@ -0,0 +1,17 @@
1
+package com.getourguide.interview.error;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+import org.springframework.http.ResponseEntity;
5
+import org.springframework.web.bind.annotation.ControllerAdvice;
6
+import org.springframework.web.bind.annotation.ExceptionHandler;
7
8
+@ControllerAdvice
9
+@Slf4j
10
+public class ErrorHandler {
11
12
+ @ExceptionHandler
13
+ public ResponseEntity<String> handleException(Exception e) {
14
+ log.error(e.getMessage());
15
+ return ResponseEntity.status(500).body("Something went wrong");
16
+ }
17
+}
0 commit comments