rafaelweingartner commented on a change in pull request #2553: Update 
inconsistent debugging info in catch block
URL: https://github.com/apache/cloudstack/pull/2553#discussion_r179924158
 
 

 ##########
 File path: 
api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
 ##########
 @@ -358,7 +358,7 @@ public void create() {
             setEntityId(result.getId());
             setEntityUuid(result.getUuid());
         } catch (NetworkRuleConflictException ex) {
-            s_logger.info("Network rule conflict: ", ex);
+            s_logger.info("Network rule conflict: " + ex.getMessage());
             s_logger.trace("Network Rule Conflict: ", ex);
             throw new 
ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
 
 Review comment:
   Here the code is throwing a new exception. What about instead of 
`ex.getMessage()`, you could use `ex` as a parameter; then, when the stack gets 
logged we would see the full stack trace, and not just from this point in the 
code.
   
   
   Ex: `throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, 
ex);`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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