Class UnexpectedThrowableEvent

  • All Implemented Interfaces:
    LoggableEvent

    public final class UnexpectedThrowableEvent
    extends java.lang.Object
    implements LoggableEvent
    Event should be thrown when Unexpected Throwable ends up in an Thread.uncaughtExceptionHandler. This event may potentially only be handled once if the exception is deemed fatal.
    • Constructor Detail

      • UnexpectedThrowableEvent

        public UnexpectedThrowableEvent​(java.lang.Throwable throwable,
                                        java.lang.String message,
                                        boolean fatal)
        Parameters:
        throwable - The throwable that was caught.
        message - Any additional information that should be displayed to the user. Nullable.
        fatal - True if this cause the application to quit forcibly. If the throwable is an Error than this is automatically true. Defaults to false.
      • UnexpectedThrowableEvent

        public UnexpectedThrowableEvent​(java.lang.Throwable throwable,
                                        java.lang.String message)
    • Method Detail

      • handleSafely

        public void handleSafely​(UnexpectedThrowableEvent.UnexpectedThrowableEventHandler handler)
        Handles the exception, this method can only be called once if the event is fatal. If the event is fatal then this method will never return.
        Parameters:
        handler - Handles the exception but in the safest way possible. Will not be run if throwable is an interrupted exception.
      • shutdownIfFatal

        public void shutdownIfFatal()
        This method will not return if the event is fatal.
      • isFatal

        public boolean isFatal()
        Returns:
        True if this should cause the program to shutdown after it is handled.