[Minor] Always add exception class in ExceptionHelper.getExceptionMessage()

This commit is contained in:
Robert von Burg 2018-09-10 17:40:26 +02:00
parent afdecd92b7
commit 79af081384
1 changed files with 22 additions and 22 deletions

View File

@ -34,12 +34,12 @@ public class ExceptionHelper {
* </p> * </p>
* *
* @param t * @param t
* the {@link Throwable} * the {@link Throwable}
* *
* @return the exception as string * @return the exception as string
*/ */
public static String getExceptionMessage(Throwable t) { public static String getExceptionMessage(Throwable t) {
return StringHelper.isEmpty(t.getMessage()) ? t.getClass().getName() : t.getMessage(); return t.getClass().getName() + ": " + t.getMessage();
} }
/** /**
@ -53,7 +53,7 @@ public class ExceptionHelper {
* </p> * </p>
* *
* @param t * @param t
* the {@link Throwable} * the {@link Throwable}
* *
* @return the exception as string * @return the exception as string
*/ */
@ -69,7 +69,7 @@ public class ExceptionHelper {
* Formats the given {@link Throwable}'s stack trace to a string * Formats the given {@link Throwable}'s stack trace to a string
* *
* @param t * @param t
* the throwable for which the stack trace is to be formatted to string * the throwable for which the stack trace is to be formatted to string
* *
* @return a string representation of the given {@link Throwable}'s stack trace * @return a string representation of the given {@link Throwable}'s stack trace
*/ */
@ -84,7 +84,7 @@ public class ExceptionHelper {
* Formats the given {@link Throwable}'s message including causes to a string * Formats the given {@link Throwable}'s message including causes to a string
* *
* @param t * @param t
* the throwable for which the messages are to be formatted to a string * the throwable for which the messages are to be formatted to a string
* *
* @return a string representation of the given {@link Throwable}'s messages including causes * @return a string representation of the given {@link Throwable}'s messages including causes
*/ */
@ -93,14 +93,14 @@ public class ExceptionHelper {
return getExceptionMessage(t); return getExceptionMessage(t);
String root = formatExceptionMessage(t.getCause()); String root = formatExceptionMessage(t.getCause());
return getExceptionMessage(t) + "\ncause:\n" + root; return getExceptionMessage(t) + "\ncause: " + root;
} }
/** /**
* Returns the root cause for the given {@link Throwable} * Returns the root cause for the given {@link Throwable}
* *
* @param throwable * @param throwable
* the {@link Throwable} for which to get the root cause * the {@link Throwable} for which to get the root cause
* *
* @return the root cause of the given {@link Throwable} * @return the root cause of the given {@link Throwable}
*/ */