Skip to content

Commit ee8c7e0

Browse files
committed
Initial Commit
1 parent a9e7f1c commit ee8c7e0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.webservice.mobile.app.exceptions;
2+
3+
import org.springframework.http.HttpHeaders;
4+
import org.springframework.http.HttpStatus;
5+
import org.springframework.http.ResponseEntity;
6+
import org.springframework.web.bind.annotation.ControllerAdvice;
7+
import org.springframework.web.bind.annotation.ExceptionHandler;
8+
import org.springframework.web.context.request.WebRequest;
9+
10+
@ControllerAdvice
11+
public class AppExceptionsHandler {
12+
13+
@ExceptionHandler(value = {UserServiceException.class})
14+
public ResponseEntity<Object> handleUserServiceException(UserServiceException exception,
15+
WebRequest webRequest){
16+
return new ResponseEntity<>(exception.getMessage(),new HttpHeaders(),
17+
HttpStatus.INTERNAL_SERVER_ERROR);
18+
}
19+
20+
}

0 commit comments

Comments
 (0)