Add error handling controller (ExceptionControllerAdvice)

This commit is contained in:
Vitaliy Fedoriv 2016-11-06 11:25:48 +02:00
parent b0c2332fb5
commit 72fa5102c5

View file

@ -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);
}
}