File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v31/app27 Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 2727import io .swagger .v3 .oas .annotations .Hidden ;
2828
2929import org .springframework .http .HttpStatus ;
30+ import org .springframework .http .ResponseEntity ;
3031import org .springframework .web .bind .annotation .ExceptionHandler ;
3132import org .springframework .web .bind .annotation .ResponseStatus ;
3233import org .springframework .web .bind .annotation .RestControllerAdvice ;
@@ -37,14 +38,14 @@ public class Advice {
3738
3839 @ ExceptionHandler (Exception .class )
3940 @ ResponseStatus (HttpStatus .INTERNAL_SERVER_ERROR )
40- public Foo handleException (Exception ex , WebRequest request ) {
41- return new Foo ();
41+ public ResponseEntity < Foo > handleException (Exception ex , WebRequest request ) {
42+ return new ResponseEntity <>( new Foo (), HttpStatus . INTERNAL_SERVER_ERROR );
4243 }
4344
4445 @ ExceptionHandler (MyException .class )
4546 @ ResponseStatus (HttpStatus .INTERNAL_SERVER_ERROR )
46- public Bar handleMyException (MyException ex , WebRequest request ) {
47- return new Bar ();
47+ public ResponseEntity < Bar > handleMyException (MyException ex , WebRequest request ) {
48+ return new ResponseEntity <>( new Bar (), HttpStatus . INTERNAL_SERVER_ERROR );
4849 }
4950
5051 @ Hidden
You can’t perform that action at this time.
0 commit comments