refactor: change response entity type in exception handler
This commit is contained in:
parent
c317b226fe
commit
61d72684c9
@ -21,7 +21,7 @@ import java.util.Date;
|
|||||||
public class GlobalExceptionHandler {
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
@ExceptionHandler(ResourceNotFoundException.class)
|
@ExceptionHandler(ResourceNotFoundException.class)
|
||||||
public ResponseEntity<?> handleHelloEntityNotFoundException(ResourceNotFoundException ex, WebRequest request) {
|
public ResponseEntity<ErrorDetails> handleHelloEntityNotFoundException(ResourceNotFoundException ex, WebRequest request) {
|
||||||
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
|
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
|
||||||
return new ResponseEntity<>(errorDetails, HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>(errorDetails, HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user