I am working on an app with remote exception-handling. That is, if an exception happens somewhere that wasn’t expected, the app closes gracefully and a report is generated in the log on our server. I am using the UncaughtExceptionHandler interface for this and it works well except that it does not seem to catch Throwables that are actually Errors.
Obviously, the best solution is to just handle everything and/or not allow anything to throw an Error in the first place. For the sake of thorough error-handling, however, I would like to be able to catch unexpected Errors as well as Exceptions. I was unable to find anything like an UncaughtErrorHandler in Android, does anyone know if such a thing is possible?
There is generally no way to catch Errors: typically once an Error happens you can’t actually intercept it. As far as I know there is no fully-supported mechanism in the Java language to catch these, and there really isn’t any one on Android either.