I’m using ionic and capacitor v2.5 for creating a plugin
I’m using the following code for catching unhandled exception in the capacitor plugin
public void load() {
super.load();
try {
Thread
.setDefaultUncaughtExceptionHandler(
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable e) {
PluginCall call = getSavedCall();
call.error("called failed:"+e.getMessage());
freeSavedCall();
}
});
} catch (SecurityException e) {
Log.e("Tag", "Error");
}
}
my problem is that whenever there is an unhandled exception, the plugin stop to respond to calls from the ionic app.
The code operates as “expected” in a sense that gets the call
from the method that throwed the exception and the call.error(..);
is executed.
I can replicate that with the following code
public void foo(PluginCall call) {
saveCall(call);
throw new exception();
}
Any thoughts on why the plugin stops to respond after that?