Skip to content

Commit e50cc28

Browse files
committed
[NO_TICKET] Add error handler
1 parent c1456e1 commit e50cc28

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)