metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From merrimanr <...@git.apache.org>
Subject [GitHub] metron pull request #779: METRON-1218: Metron REST should return better erro...
Date Fri, 29 Sep 2017 12:57:05 GMT
Github user merrimanr commented on a diff in the pull request:

    https://github.com/apache/metron/pull/779#discussion_r141861097
  
    --- Diff: metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/RestExceptionHandler.java
---
    @@ -45,4 +45,14 @@ private HttpStatus getStatus(HttpServletRequest request) {
         }
         return HttpStatus.valueOf(statusCode);
       }
    +
    +  private String getFullMessage(Throwable ex) {
    +    String fullMessage = ex.getMessage();
    +    Throwable cause = ex.getCause();
    +    while(cause != null) {
    +      fullMessage = cause.getMessage();
    +      cause = cause.getCause();
    +    }
    +    return fullMessage;
    --- End diff --
    
    @cestella I initially tried to include the whole stack trace in the response but I couldn't
find a good way to format it.  Multi-line statements just don't work well in JSON so I settled
on the root cause because it's usually the most important piece of information anyways.  The
whole stack trace is logged, just not returned in the JSON response.  Any ideas on how to
do this better?


---

Mime
View raw message