public final 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 | Class and Description |
---|---|
static interface |
ExceptionHelper.ExceptionEvaluator<T> |
Modifier and Type | Field and Description |
---|---|
static String |
ERROR_CODE_PROPERTY
This is the property to set the error code to no the message it is the
property name the Transport provider uses set the set the error code on the
underlying message
|
protected static Log |
logger
logger used by this class
|
Modifier and Type | Method and Description |
---|---|
static String |
getDocUrl(Class<?> exception)
Deprecated.
since 3.8.0
|
static Class |
getErrorClass(int code) |
static int |
getErrorCode(Class exception) |
static String |
getErrorCodePropertyName(String protocol,
MuleContext muleContext) |
static String |
getErrorMapping(String protocol,
Class exception,
MuleContext muleContext)
Maps an exception thrown for a certain protocol to an error.
|
static Map |
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 String |
getJavaDocUrl(Class<?> exception)
Deprecated.
since 3.8.0
|
static Throwable |
getNonMuleException(Throwable t) |
static Throwable |
getRootException(Throwable t) |
static MuleException |
getRootMuleException(Throwable t) |
static Throwable |
getRootParentException(Throwable t) |
static String |
getTransportErrorMapping(String protocol,
Class exception,
MuleContext muleContext)
Maps an exception thrown for a certain protocol to an error.
|
static void |
registerExceptionReader(ExceptionReader reader)
Registers an exception reader with Mule
|
static Throwable |
sanitize(Throwable t)
Removes some internal Mule entries from the stacktrace.
|
static Throwable |
sanitizeIfNeeded(Throwable t) |
static Throwable |
summarise(Throwable t,
int depth)
Removes some internal Mule entries from the stacktrace.
|
static <T> T |
traverseCauseHierarchy(Throwable e,
ExceptionHelper.ExceptionEvaluator<T> evaluator) |
static <T extends Throwable> |
unwrap(T t) |
static String |
writeException(Throwable t) |
public static final String ERROR_CODE_PROPERTY
protected static final Log logger
public static int getErrorCode(Class exception)
public static Class getErrorClass(int code)
public static String getErrorCodePropertyName(String protocol, MuleContext muleContext)
public static String getErrorMapping(String protocol, Class exception, MuleContext muleContext)
protocol
- scheme for the transportexception
- exception mapped to errormuleContext
- the application contextpublic static String getTransportErrorMapping(String protocol, Class exception, MuleContext muleContext)
protocol
- scheme for the transportexception
- exception mapped to errormuleContext
- the application context@Deprecated public static String getJavaDocUrl(Class<?> exception)
@Deprecated public static String getDocUrl(Class<?> exception)
public static Throwable sanitize(Throwable t)
public static Throwable summarise(Throwable t, int depth)
public static MuleException getRootMuleException(Throwable t)
public static void registerExceptionReader(ExceptionReader reader)
reader
- the reader to register.public static <T> T traverseCauseHierarchy(Throwable e, ExceptionHelper.ExceptionEvaluator<T> evaluator)
public static ExceptionReader getExceptionReader(Throwable t)
t
- the exception to get a reader forpublic static <T extends Throwable> T unwrap(T t)
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.