diff options
Diffstat (limited to 'app/src/main/java/no/topi/fiken/display/ExceptionHandler.java')
-rw-r--r-- | app/src/main/java/no/topi/fiken/display/ExceptionHandler.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/src/main/java/no/topi/fiken/display/ExceptionHandler.java b/app/src/main/java/no/topi/fiken/display/ExceptionHandler.java new file mode 100644 index 0000000..3d4560b --- /dev/null +++ b/app/src/main/java/no/topi/fiken/display/ExceptionHandler.java @@ -0,0 +1,22 @@ +package no.topi.fiken.display; + +import android.util.Log; + +public class ExceptionHandler implements Thread.UncaughtExceptionHandler { + private final static String TAG = DefaultDisplayService.class.getSimpleName(); + + public static final ExceptionHandler EXCEPTION_HANDLER = new ExceptionHandler(); + + @Override + public void uncaughtException(Thread thread, Throwable ex) { + Log.e(TAG, "Uncaught", ex); + + if (ex instanceof RuntimeException) { + throw (RuntimeException) ex; + } + if (ex instanceof Error) { + throw (Error) ex; + } + throw new RuntimeException(ex); + } +} |