Spring Data Rest exception handling - Return generic error response -
i want know how can handle internal server error type exceptions in spring data rest such jpa exceptions etc. due malformed request or database crash. did research found better way using @controlleradvice couldn't find working example of it. looked @ both these questions still unanswered.
how can handle exceptions spring data rest , pagingandsortingrepository?
global exception handling rest exposed spring-data
can me working example of how use @controlleradvice , write custom error response client whenever there exception.
you can this:
@controlleradvice(basepackageclasses = repositoryrestexceptionhandler.class) public class genericexceptionhandler { @exceptionhandler responseentity handle(exception e) { return new responseentity("some message", new httpheaders(), httpstatus.bad_request); } }
Comments
Post a Comment