`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
40
votes
2 answers
Should use both AppDomain.UnhandledException and Application.DispatcherUnhandledException?
After reading some excellent posts about the difference between AppDomain.UnhandledException and Application.DispatcherUnhandledException, it appears that I should be handling both. This is because it is significantly more likely the user can…

Kyle
- 575
- 1
- 4
- 9
31
votes
4 answers
Spring Async Uncaught Exception handler
@Override
@Async
public void asyncExceptionTest() {
int i=1/0;
}
How can I log this using Spring Async framework without having to put try catch around every async method? It doesn't seem to pass to the DefaultUncaughtExceptionHandler like…

DD.
- 21,498
- 52
- 157
- 246
25
votes
3 answers
GMS IllegalStateException : Results have already been set?
From last week , Our app occur a lot of exception about this .we use GMS 11.0.2
Fatal Exception: java.lang.IllegalStateException: Results have already been set
at com.google.android.gms.common.internal.zzbo.zza(Unknown Source)
at…

Jamin
- 300
- 4
- 10
19
votes
2 answers
Uncaught Error/Exception Handling in Swift
I know there is an UncaughtExceptionHandler in Cocoa, However I am looking for same thing for Swift. i.e. whenever there is any error/exception in application which is not caught locally there due to any mistake, it should bubble all the way to the…

Sunny Tambi
- 2,393
- 3
- 23
- 27
15
votes
4 answers
How to re-throw an exception
In my onCreate() I set an UncaughtException handler as follows:
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable throwable) {
…

Eternal Learner
- 2,602
- 5
- 27
- 38
10
votes
2 answers
Android app doesn't crash, but not responding on uncaught exceptions
I recently noticed, that my app doesn't crash when an uncaught exception occurs, but it is not responding. I use Google Analytics to get insight of crashes, I suspect that this may be the cause of the problem.
When I throw a NullPointerException in…

hunyadym
- 2,213
- 25
- 39
9
votes
2 answers
Do errors thrown within UncaughtExceptionHandler get swallowed?
Thread.UncaughtExceptionHandler states that when the method which handles uncaught exceptions itself throws an exception, that exception will be ignored:
void uncaughtException(Thread t, Throwable e):
Method invoked when the given thread terminates…

Pacerier
- 86,231
- 106
- 366
- 634
8
votes
2 answers
Thread.setDefaultUncaughtExceptionHandler in Spring
I am developing a Spring application, and was wondering if there a part of the framework that let's me do something like this in a more elegant way, such as configuring something in XML?

mogronalol
- 2,946
- 8
- 38
- 56
8
votes
1 answer
Java: Mysterious Java uncaught exception handler [with code]
Something weird has happened. I've written a Java program, where I've done nothing to handle uncaught exceptions in any special way. But when I run this one particular program in Windows 7, there is this uncaught exception in a static context…

Timothy Miller
- 1,527
- 4
- 28
- 48
8
votes
3 answers
Toast not showing up in UnCaughtExceptionHandler
I am using this code to handle any uncaught exceptions which might cause my application to crash.
public class ExceptionHandler implements java.lang.Thread.UncaughtExceptionHandler {
private final Context myContext;
public…

Archie.bpgc
- 23,812
- 38
- 150
- 226
7
votes
1 answer
Java UncaughtExceptionHandler haven't got any exception using JNI
I have a Java library which run a series of tasks. And I registered a default uncaught exception handler using:
Thread.setDefaultUncaughtExceptionHandler(new JavaUncaughtExceptionHandler());
The UncaughtExceptionHandler implements…

user788767
- 73
- 4
7
votes
1 answer
Handle unhandled exception from a reference dll
I have created a c# dll to handle all the unhandled exceptions from the application.
added
AppDomain appDomain = AppDomain.CurrentDomain;
appDomain.UnhandledException += new UnhandledExceptionEventHandler(MyErrorHandler);
code in my dll project ,…

Sumeshk
- 1,980
- 20
- 33
7
votes
2 answers
Android Restarting the Application
I am trying to restart the app when the crash occurs in android using Thread.UncaughtExceptionHandler. Can i restart the app with current activity stack as a new process?? If yes how can i do it?

PgmFreek
- 6,374
- 3
- 36
- 47
6
votes
1 answer
How to attach uncaught exception handler/completion to CompletableFuture chain
The use-case:
an exception occurs during CompletableFuture chain
none of exceptionally, whenComplete or handle method is attached to that CompletableFuture chain
The result:
The exception is never caught and there's no tracking/log of it. Which in…

alex.savov
- 61
- 2
6
votes
1 answer
Android UncaughtExceptionHandler to finish app
I want to close the app after logging an unhandled exception. After searching here i made the following:
public class MyApplication extends Application {
//uncaught exceptions
private Thread.UncaughtExceptionHandler defaultUEH;
//…

cobolero
- 412
- 1
- 6
- 13