Skip to content

Commit

Permalink
[Minor] Added ExceptionHelper.getRootCauseMessage()
Browse files Browse the repository at this point in the history
  • Loading branch information
eitch committed May 3, 2024
1 parent 19825b3 commit 3054d5f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions utils/src/main/java/li/strolch/utils/helper/ExceptionHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,19 @@ public static String getRootCauseMessage(Throwable throwable) {
return getExceptionMessage(getRootCause(throwable), true);
}

/**
* Returns {@link #getExceptionMessage(Throwable, boolean)} for the root cause of the given {@link Throwable}
*
* @param throwable the throwable for which to get the message of the root cause
* @param withClassName if true, then exception class name is prepended to the exception message, if the exception
* message is null, then this param is ignored
*
* @return {@link #getExceptionMessage(Throwable, boolean)} for the root cause of the given {@link Throwable}
*/
public static String getRootCauseMessage(Throwable throwable, boolean withClassName) {
return getExceptionMessage(getRootCause(throwable), withClassName);
}

/**
* Walks the causes for the given {@link Throwable} and sees if the given cause exists
*
Expand Down

0 comments on commit 3054d5f

Please sign in to comment.