Skip to content

Commit

Permalink
eclipse-ditto#985 provide exception class name if exception message i…
Browse files Browse the repository at this point in the history
…s null in connectivity error responses

Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
  • Loading branch information
dguggemos committed Mar 25, 2021
1 parent dce01a4 commit ae095b6
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,12 @@ private static String describeEventualCause(@Nullable final Throwable throwable)
}
final Throwable cause = throwable.getCause();
if (cause == null || cause.equals(throwable)) {
return "Cause: " + throwable.getMessage();
final String message =
throwable.getMessage() != null
? throwable.getMessage()
// if message is null, provide at least the exception class name
: throwable.getClass().getName();
return "Cause: " + message;
} else {
return describeEventualCause(cause);
}
Expand Down

0 comments on commit ae095b6

Please sign in to comment.