mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 13:05:49 +00:00
Add error handling controller (ExceptionControllerAdvice)
This commit is contained in:
parent
b0c2332fb5
commit
72fa5102c5
1 changed files with 14 additions and 0 deletions
|
@ -0,0 +1,14 @@
|
|||
package org.springframework.samples.petclinic.rest;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
||||
@ControllerAdvice
|
||||
public class ExceptionControllerAdvice {
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<Exception> exception(Exception e) {
|
||||
return ResponseEntity.badRequest().body(e);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue