public class ExceptionHelper extends Object
ExceptionHelper provides a number of helper functions that can be useful for dealing with Mule exceptions. This class
has 3 core functions -
1. ErrorCode lookup. A corresponding Mule error code can be found using for a given Mule exception 2. Additional Error
information such as Java doc url for a given exception can be resolved using this class 3. Error code mappings can be looked up
by providing the the protocol to map to and the Mule exception.| Modifier and Type | Field and Description |
|---|---|
static String[] |
DEFAULT_STACKTRACE_FILTER |
static String[] |
stackTraceFilter
A comma-separated list of internal packages/classes which are removed from sanitized stacktraces.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ExceptionHelper()
Do not instantiate.
|
| Modifier and Type | Method and Description |
|---|---|
static Map<String,Object> |
getExceptionInfo(Throwable t) |
static ExceptionReader |
getExceptionReader(Throwable t)
Gets an exception reader for the exception.
|
static List<Throwable> |
getExceptionsAsList(Throwable t) |
static String |
getExceptionStack(Throwable t) |
static Throwable |
getNonMuleException(Throwable t) |
static Throwable |
getRootException(Throwable t) |
static MuleException |
getRootMuleException(Throwable t) |
static void |
registerExceptionReader(ExceptionReader reader)
Registers an exception reader on the Mule Runtime to be used only by the artifact it belongs to
|
static void |
registerGlobalExceptionReader(ExceptionReader reader)
Registers an exception reader on the Mule Runtime.
|
static Throwable |
sanitize(Throwable t)
Removes some internal Mule entries from the stacktrace.
|
static Throwable |
summarise(Throwable t,
int depth)
Removes some internal Mule entries from the stacktrace.
|
static boolean |
unregisterExceptionReader(ExceptionReader reader)
Unregisters an exception reader from the Mule Runtime
|
static <T extends Throwable> |
unwrap(T t) |
public static final String[] DEFAULT_STACKTRACE_FILTER
public static String[] stackTraceFilter
#fullStackTracespublic static <T extends Throwable> T unwrap(T t)
public static ExceptionReader getExceptionReader(Throwable t)
ClassLoader is used to determine the appropriate
reader, querying only those registered by the same or an ancestor classloader.t - the exception to get a reader forpublic static MuleException getRootMuleException(Throwable t)
public static Throwable sanitize(Throwable t)
public static Throwable summarise(Throwable t, int depth)
public static List<Throwable> getExceptionsAsList(Throwable t)
t - public static void registerGlobalExceptionReader(ExceptionReader reader)
Only the Runtime itself may register global readers.
reader - the reader to register.public static void registerExceptionReader(ExceptionReader reader)
reader - the reader to register.public static boolean unregisterExceptionReader(ExceptionReader reader)
reader - the reader to register.true if the passed reader is registeredCopyright © 2025 MuleSoft, Inc.. All rights reserved.