Class CrashHandler

java.lang.Object
com.prineside.tdi2.utils.errorhandling.CrashHandler

public final class CrashHandler extends Object
Handles uncaught exceptions on threads and notifies ActionResolver about them
  • Constructor Details

    • CrashHandler

      public CrashHandler()
  • Method Details

    • setActionResolver

      public static void setActionResolver(ActionResolver actionResolver)
      Set an ActionResolver which will be notified about a crash. If threads were handled before ActionResolver is set, it will be notified about those threads too. Automatically handles exceptions on the thread this method is being called on.
      Parameters:
      actionResolver - a resolver on which the handleThreadExceptions() method will be called in case an unhandled exception occurs
    • isThreadExceptionsHandled

      public static boolean isThreadExceptionsHandled(Thread thread)
      Check if thread exceptions are handled
      Parameters:
      thread - a thread to check
      Returns:
      true if any of the handleThreadExceptions...() methods were called for the specified thread
    • handleThreadExceptions

      public static void handleThreadExceptions(Thread thread)
      Handle uncaught exceptions on a thread and exit the app if they occur
      Parameters:
      thread - a thread to handle
    • handleThreadExceptionsForgiving

      public static void handleThreadExceptionsForgiving(Thread thread)
      Handle uncaught exceptions on a thread but do not exit the app
      Parameters:
      thread - a thread to handle
    • report

      public static void report(String reason)
    • report

      public static void report(String reason, Throwable exception)