public class ExceptionHelper
extends java.lang.Object
Constructor and Description |
---|
ExceptionHelper() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getMessage(java.lang.Throwable ex)
Java exceptions often contain no message or a few details *without* describing the actual error.
|
static java.lang.String |
getStackTrace(java.lang.Throwable ex)
Gets the stack trace as a String (i.e.
|
public static java.lang.String getMessage(java.lang.Throwable ex)
IndexOutOfBoundsException
has the message "Index ... Size ..." but does not
include "Index Out Of Bounds" in its message.
FileNotFoundException
includes the file path, but does not include "File not found".
So when displaying the message to a user, one is forced to either show Throwable.getMessage()
which shows
meaningless information or Throwable.toString()
which includes the full type name,
e.g. "java.lang.nio.NoSuchFileException"public static java.lang.String getStackTrace(java.lang.Throwable ex)