You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2021/09/06 14:15:22 UTC

[GitHub] [incubator-shenyu] ttttangzhen commented on issue #2033: [Discussion] Discussion on shenyu code suggestions

ttttangzhen commented on issue #2033:
URL: https://github.com/apache/incubator-shenyu/issues/2033#issuecomment-913683124


   
   - Avoid directly new RuntimeException, and use a custom Exception class to inherit RuntimeException
   
   ```java
       public DynamicMessage parse(final InputStream inputStream) {
           try {
               //...
           } catch (IOException e) {
               throw new RuntimeException("Unable to merge from the supplied input stream", e);
           }
       }
   ```
   
   - Avoid magic values ​​in the code
   ```java
       public Mono<Void> execute(final ServerWebExchange exchange, final ShenyuPluginChain chain) {
           Boolean skip = Objects.requireNonNull(exchange.<Boolean>getAttribute("skip"));
           //return ...
       }
   ```


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org