Package spark
Class ExceptionMapper
java.lang.Object
spark.ExceptionMapper
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map
<Class<? extends Exception>, ExceptionHandlerImpl> Holds a map of Exception classes and associated handlersprivate static ExceptionMapper
Holds an exception mapper instance for use in servlet mode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the exception mappings.getHandler
(Class<? extends Exception> exceptionClass) Returns the handler associated with the provided exception classgetHandler
(Exception exception) Returns the handler associated with the provided exception classstatic ExceptionMapper
Deprecated.static ExceptionMapper
Returns exception mapper instance used in servlet modevoid
map
(Class<? extends Exception> exceptionClass, ExceptionHandlerImpl handler) Maps the given handler to the provided exception type.
-
Field Details
-
servletInstance
Holds an exception mapper instance for use in servlet mode -
exceptionMap
Holds a map of Exception classes and associated handlers
-
-
Constructor Details
-
ExceptionMapper
public ExceptionMapper()Class constructor
-
-
Method Details
-
getInstance
Deprecated. -
getServletInstance
Returns exception mapper instance used in servlet mode- Returns:
- servlet instance
-
map
Maps the given handler to the provided exception type. If a handler was already registered to the same type, the handler is overwritten.- Parameters:
exceptionClass
- Type of exceptionhandler
- Handler to map to exception
-
getHandler
Returns the handler associated with the provided exception class- Parameters:
exceptionClass
- Type of exception- Returns:
- Associated handler
-
getHandler
Returns the handler associated with the provided exception class- Parameters:
exception
- Exception that occurred- Returns:
- Associated handler
-
clear
public void clear()Clear the exception mappings.
-