Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thread.setDefaultUncaughtExceptionHandler for Errors

I am working on an Android app where for uncaught exceptions I do this

Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler()...);

This way when an uncaught exception is thrown I log it and send a request to my issue tracker to create a new issue. I would like to do the same for errors. Is there a way to intercept uncaught errors in Java or Android? I have combed through stackoverflow and Google and have not found anything.

like image 538
Jason Crosby Avatar asked Sep 17 '15 16:09

Jason Crosby


1 Answers

After comments on the functionality of this and the fact that I was not able to find any info regarding this, and not being able to find and info related to this, I did some testing and it does in fact get called when an error is thrown as well. The name is misleading but it does in fact work with errors as well. Thanks to the comments for the guidance.

like image 92
Jason Crosby Avatar answered Sep 24 '22 13:09

Jason Crosby