Package 

Class ErrorHandler

  • All Implemented Interfaces:
    java.lang.Thread.UncaughtExceptionHandler

    
    public class ErrorHandler
     implements Thread.UncaughtExceptionHandler
                        

    Handle your errors automatically. Send them to sentry, output them to the console and/or write them to the error log!

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      ErrorHandler() Its not recommended to use the instance.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static void enableSentry(String sentryDns) To enable sentry reporting past the sentry dns string to this function!
      static void enableSentry(String sentryDns, Double tracesSampleRate, String release) To enable sentry reporting past the sentry dns string to this function!
      static void enableCatchUncaughtException() Enable the exception handling for uncaught exceptions.
      static void enableErrorLogFile() Enable the 'error.log' file to which the stack traces will also be written.
      static void handle(Throwable e) Handle an exception.
      static void handle(Throwable e, SentryLevel level, Array<String> debugInformation) Handle an exception and send more data to Sentry.
      static void handleFatal(Throwable e) Handle an exception and exit the program with exit a non zero exit code.
      static void handleFatal(Throwable e, int exitCode) Handle an exception and exit the program with exit a non zero exit code.
      void uncaughtException(Thread t, Throwable e) Internal function from the UncaughtExceptionHandler implementation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ErrorHandler

        ErrorHandler()
        Its not recommended to use the instance.
    • Method Detail

      • enableSentry

         static void enableSentry(String sentryDns)

        To enable sentry reporting past the sentry dns string to this function!

        Parameters:
        sentryDns - The sentry dns string for error reporting to sentry.io!
      • enableSentry

         static void enableSentry(String sentryDns, Double tracesSampleRate, String release)

        To enable sentry reporting past the sentry dns string to this function!

        Parameters:
        sentryDns - The sentry dns string for error reporting to sentry.io!
        tracesSampleRate - https://docs.sentry.
        release - https://docs.sentry.
      • enableCatchUncaughtException

         static void enableCatchUncaughtException()

        Enable the exception handling for uncaught exceptions. Uncaught exceptions will trigger a fatal exception!

      • enableErrorLogFile

         static void enableErrorLogFile()

        Enable the 'error.log' file to which the stack traces will also be written.

      • handle

         static void handle(Throwable e)

        Handle an exception.

        Parameters:
        e - The exception to handle.
      • handle

         static void handle(Throwable e, SentryLevel level, Array<String> debugInformation)

        Handle an exception and send more data to Sentry.

        Parameters:
        e - The exception to handle.
        level - The error level for Sentry.
        debugInformation - The debug infos.
      • handleFatal

         static void handleFatal(Throwable e)

        Handle an exception and exit the program with exit a non zero exit code.

        Parameters:
        e - The exception to handle.
      • handleFatal

         static void handleFatal(Throwable e, int exitCode)

        Handle an exception and exit the program with exit a non zero exit code.

        Parameters:
        e - The exception to handle.
        exitCode - The exit code to report.
      • uncaughtException

         void uncaughtException(Thread t, Throwable e)

        Internal function from the UncaughtExceptionHandler implementation.

        Parameters:
        t - The current thread.
        e - The uncaught exception.