diwenzheng commented on issue #2621:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2621#issuecomment-965011395


   > 我自己试了可以用这种方法返回异常
   > 
   > ```java
   >     @GetMapping("/hello")
   >     public ResponseEntity<?> hello() {
   >         InvocationException exception = new 
InvocationException(Response.Status.BAD_REQUEST, "hello");
   >         ResponseEntity<InvocationException> response = new 
ResponseEntity<>(exception, HttpStatus.BAD_REQUEST);
   >         return response;
   >     }
   > ```
   
   这种可以吗?响应体如果是自己的po还可以传入异常类吗? 我们已经发现了处理方式,第一个 使用Response这个替代 
ResponseEntity,该对象内部是存在createFail方式的 那么第二个就是 使用自定义处理链 来处理自己想要返回的异常情况。
   
   本质原因是因为内部还是过于依赖Swagger的东西,其实与springboot还是有很大的区别,即使用过程中给开发人员带来很多不便。@liubao68


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to