`UncaughtExceptionHandler` is a [tag:java] interface defining the handlers invoked whenever a Thread throws an exception that is not caught by any `try` block. A class that implements this interface can be registered so that the programmer can control what should happen in this case.
Questions tagged [uncaughtexceptionhandler]
102 questions
1
vote
1 answer
UncaughtExceptionHandler not called
I am having trouble using the UncaughtExceptionHandler in Groovy/Java.
class UncaughtExceptionLogger implements Thread.UncaughtExceptionHandler {
@Override
void uncaughtException(Thread t, Throwable e) {
//TODO do some logging;
…

Georgi Georgiev
- 3,854
- 5
- 29
- 39
1
vote
0 answers
Android app crashes inside uncaught exception handler (Xamarin)
I'm trying to implement an uncaught exception handler in an Android only app built with Xamarin for logging purposes.
AppDomain.CurrentDomain.UnhandledException += (o, e) =>…

pinkie
- 144
- 1
- 2
- 9
1
vote
0 answers
why uncaughtexceptionhandler is not working in release build
Here is my uncaught exception handler in app delegate and I am registering it.
void myHandler(NSException * exception)
{
NSError *error;
NSString *stringToWrite = [[NSString alloc]initWithFormat:@"Name:%@ Reason:%@…

Shankar Naik
- 401
- 5
- 16
1
vote
0 answers
Contact webservice on application crash
I want my Android app to handle uncaught exceptions by sending the stacktrace to my backend application using a (POST) webservice. In order to do this, I set up an UncaughtExceptionHandler in my parent…

Jenever
- 500
- 5
- 17
1
vote
2 answers
Is UncaughtExceptionHandler set application wide?
I have set an UncaughtExceptionHandler, so that I can write out stack traces to disk when my app crashes. I set this handler like this:
if (!(Thread.getDefaultUncaughtExceptionHandler() instanceof CustomExceptionHandler)) {
exceptionHandler…

Bart Friederichs
- 33,050
- 15
- 95
- 195
1
vote
1 answer
Is there a Node.js equivalent of Java UncaughtExceptionHandler?
I had some problematic code in a Node.js application which caused an error (manifested as strange output) but not a total crash. It displayed nothing in the console to indicate an error occurred, and I only identified the root cause by a lot of…

HomerPlata
- 1,687
- 5
- 22
- 39
1
vote
2 answers
Display Dialog after uncaught exception
I tried to start an activity with an implicit intent after an uncaught exception with the unCaughtExceptionHandler. The intent should start an Activity as a Dialog in the same app that has crashed. This corresponds to the example listed in this…

Harry500
- 11
- 1
1
vote
1 answer
Android - UncaughtExceptionHandler : Max time to complete its execution
I understand that UncaughtExceptionHandler runs on MainThread to handle all the unhandled exceptions. Am trying to write the throwable and thread info to a file, but I have to do this on main thread only. I am concerned that doing so may throw ANR…

prago
- 5,225
- 5
- 25
- 27
1
vote
1 answer
Default UncaughtExceptionHandler not being called from nested thread
I've read through several examples of how to use an UncaughtExceptionHandler to pass exceptions from a nested thread to a parent thread. Currently, my nested thread's UncaughtExceptionHandler catches exceptions as it should. I've set it to pass…

Anna W.
- 37
- 1
- 6
1
vote
1 answer
Application hanging when trying to start a specific activity after uncaught exception
I have following code to handle any uncaught exceptions and re-start the application from the Splash screen as there are a whole bunch of initilizations that I do in the Splash Screen. This is my launch screen.
Now I have the following code to this…

Sunny
- 7,444
- 22
- 63
- 104
1
vote
1 answer
JUnique locked application doesn't run if the application crashes
I'm developing a Java application. And I wanted to prevent a user to run simultaneously more instances of the same Java application. I used JUnique app locking library for Java and it works great. But has a serious issue when it crashes.
The…

Crawler
- 1,988
- 3
- 21
- 42
1
vote
1 answer
Safe exiting an Application from a ExceptionHandler subclass?
I'm new to Android as well as java, i'll try my best to be as specific as possibe.
I have an app with one activity and several fragments and classes along with an ExceptionHandler subclass which implements default UncaughtExceptionHandler. I was…

N29
- 141
- 1
- 17
1
vote
1 answer
UncaughtExceptionHandler behaves unexpectedly, then freezes
My consumer doesn't work the way I expect it to. Below is an sscce of what happens in my real program.
Expected:
Print In finally!
Print About to print stacktrace
Print a NullPointerException stacktrace.
Actual:
Print In finally!
Hang, in…

durron597
- 31,968
- 17
- 99
- 158
1
vote
0 answers
How to quit my app if there is an uncaught exception?
I want to quit my app if there is an uncaught exception. For that I'm using System.exit(10) and Process.killProcess(I know this is not a good practice to call these methods). My code is the following:
public class UncaughtExceptionHandler implements…

Jainendra
- 24,713
- 30
- 122
- 169
1
vote
2 answers
How to prevent a service from getting killed by Android because of uncaught exceptions?
I am investigating if there are any ways to prevent an android service being killed because of uncaught exception.
We have 10 UI apps talking to 5-6 services. The platform is Android 2.2.
Because of unforeseen conditions, some of the logic in the…

videoguy
- 1,732
- 2
- 24
- 49