org.mule.config
Class ExceptionHelper

java.lang.Object
  extended by org.mule.config.ExceptionHelper

public final class ExceptionHelper
extends java.lang.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.


Field Summary
static java.lang.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
 
Method Summary
static java.lang.String getDocUrl(java.lang.Class<?> exception)
           
static java.lang.Class getErrorClass(int code)
           
static int getErrorCode(java.lang.Class exception)
           
static java.lang.String getErrorCodePropertyName(java.lang.String protocol)
           
static java.lang.String getErrorMapping(java.lang.String protocol, java.lang.Class exception)
           
static java.util.Map getExceptionInfo(java.lang.Throwable t)
           
static ExceptionReader getExceptionReader(java.lang.Throwable t)
          Gets an exception reader for the exception
static java.util.List getExceptionsAsList(java.lang.Throwable t)
           
static java.lang.String getExceptionStack(java.lang.Throwable t)
           
static java.lang.String getJavaDocUrl(java.lang.Class<?> exception)
           
static java.lang.Throwable getRootException(java.lang.Throwable t)
           
static MuleException getRootMuleException(java.lang.Throwable t)
           
static java.lang.Throwable getRootParentException(java.lang.Throwable t)
           
static void registerExceptionReader(ExceptionReader reader)
          Registers an exception reader with Mule
static java.lang.Throwable sanitize(java.lang.Throwable t)
          Removes some internal Mule entries from the stacktrace.
static java.lang.Throwable summarise(java.lang.Throwable t, int depth)
          Removes some internal Mule entries from the stacktrace.
static
<T extends java.lang.Throwable>
T
unwrap(T t)
           
static java.lang.String writeException(java.lang.Throwable t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_CODE_PROPERTY

public static final java.lang.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

See Also:
Constant Field Values

logger

protected static final Log logger
logger used by this class

Method Detail

getErrorCode

public static int getErrorCode(java.lang.Class exception)

getErrorClass

public static java.lang.Class getErrorClass(int code)

getErrorCodePropertyName

public static java.lang.String getErrorCodePropertyName(java.lang.String protocol)

getErrorMapping

public static java.lang.String getErrorMapping(java.lang.String protocol,
                                               java.lang.Class exception)

getJavaDocUrl

public static java.lang.String getJavaDocUrl(java.lang.Class<?> exception)

getDocUrl

public static java.lang.String getDocUrl(java.lang.Class<?> exception)

getRootException

public static java.lang.Throwable getRootException(java.lang.Throwable t)

sanitize

public static java.lang.Throwable sanitize(java.lang.Throwable t)
Removes some internal Mule entries from the stacktrace. Modifies the passed-in throwable stacktrace.


summarise

public static java.lang.Throwable summarise(java.lang.Throwable t,
                                            int depth)
Removes some internal Mule entries from the stacktrace. Modifies the passed-in throwable stacktrace.


getRootParentException

public static java.lang.Throwable getRootParentException(java.lang.Throwable t)

getRootMuleException

public static MuleException getRootMuleException(java.lang.Throwable t)

getExceptionsAsList

public static java.util.List getExceptionsAsList(java.lang.Throwable t)

getExceptionInfo

public static java.util.Map getExceptionInfo(java.lang.Throwable t)

getExceptionStack

public static java.lang.String getExceptionStack(java.lang.Throwable t)

registerExceptionReader

public static void registerExceptionReader(ExceptionReader reader)
Registers an exception reader with Mule

Parameters:
reader - the reader to register.

getExceptionReader

public static ExceptionReader getExceptionReader(java.lang.Throwable t)
Gets an exception reader for the exception

Parameters:
t - the exception to get a reader for
Returns:
either a specific reader or an instance of DefaultExceptionReader. This method never returns null;

writeException

public static java.lang.String writeException(java.lang.Throwable t)

unwrap

public static <T extends java.lang.Throwable> T unwrap(T t)


Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.