liubao68 commented on a change in pull request #1349: [SCB-1525]print codec 
error stack
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1349#discussion_r337346114
 
 

 ##########
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/RestCodec.java
 ##########
 @@ -61,7 +64,11 @@ public static void argsToRest(Object[] args, 
RestOperationMeta restOperation,
       try {
         paramValues[idx] = param.getParamProcessor().getValue(request);
       } catch (Exception e) {
-        // Avoid information leak of user input.
+        // Avoid information leak of user input, and add option for debug use.
+        if (DynamicPropertyFactory.getInstance().getBooleanProperty(
+            RestConst.PRINT_CODEC_ERROR_MESSGAGE, false).get()) {
+          LOG.error("", e);
+        }
 
 Review comment:
   It's not possible doing that in java-chassis. "Exception" is a complicated 
object that cannot expressed by swagger, and the serialization/deserialization 
may couple consumer/provider.  
   
   see:
   
https://docs.servicecomb.io/java-chassis/zh_CN/general-development/error-handling.html
   
   Developers should not send unkown exceptions to consumers to avoid 
un-neccessary information leak and try to catch exceptions and return friendly 
error code and error mesasge is recommented. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to