public interface ExceptionHandler
extends java.util.function.Consumer<java.lang.Throwable>
Thread.UncaughtExceptionHandler
, except that exceptions provided to this
interface are handled on the same thread that threw the exception, and the thread that threw it
likely WONT die.Modifier and Type | Field and Description |
---|---|
static ExceptionHandler |
IGNORE_HANDLER
Default
ExceptionHandler implementation which will swallow the exception with no action. |
static ExceptionHandler |
PRINT_STACKTRACE_HANDLER
Default
ExceptionHandler implementation which will invoke
Throwable.printStackTrace() . |
Modifier and Type | Method and Description |
---|---|
default void |
accept(java.lang.Throwable thrown) |
void |
handleException(java.lang.Throwable thrown)
An exception was thrown on this thread, and is now being provided to this handler to handle
it (possibly just to simply log it occurred).
|
static final ExceptionHandler PRINT_STACKTRACE_HANDLER
ExceptionHandler
implementation which will invoke
Throwable.printStackTrace()
.static final ExceptionHandler IGNORE_HANDLER
ExceptionHandler
implementation which will swallow the exception with no action.void handleException(java.lang.Throwable thrown)
thrown
- Throwable that was thrown, and caughtdefault void accept(java.lang.Throwable thrown)
accept
in interface java.util.function.Consumer<java.lang.Throwable>