File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/main/java/com/webservice/mobile/app/exceptions Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments