Skip to content

Commit

Permalink
fix: inspect IOException immediate cause if there are no details in t…
Browse files Browse the repository at this point in the history
…he exception (#159)
  • Loading branch information
shivanesabharwal authored Feb 14, 2023
1 parent ccc8951 commit 45f409f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ private static String enrichReason(String reason, Throwable cause) {
return prefix + googleJsonResponseException.getDetails().getMessage();
}
} else {
return prefix + cause.toString();
String throwableDetails = cause.toString();
// if the `cause` itself does not have a detailed message, ask for the message of its cause.
if (throwableDetails.isEmpty()) {
Throwable parentCause = cause.getCause();
if (parentCause != null) throwableDetails = parentCause.toString();
}
return prefix + throwableDetails;
}
return reason;
}
Expand Down

0 comments on commit 45f409f

Please sign in to comment.