It took me hours to figure it out:
Application_Error does not fire in resumable subs
Test:
I found a 4 years old post from Erel. I guess he forgot to fix it.
Is there a workaround or when we can expect a fix?
www.b4x.com
i tried to implement my own UncaughtExceptionHandler wich fires the handlecrash event even in resumable subs, unfortunally im unable to show any gui object like a msgbox in my handlecrash sub (wich works in Application_Error).
i assume the looper of the UI thread crashed
Any ideas?
Cheers
Application_Error does not fire in resumable subs
Test:
B4X:
Private Sub Button1_Click
Wait For (crash) Complete (success As Boolean)
End Sub
Sub crash As ResumableSub
Sleep(5000)
Dim i As Int = "kjhlkJ"
Return True
End Sub
I found a 4 years old post from Erel. I guess he forgot to fix it.
Is there a workaround or when we can expect a fix?
Application_Error don´t fire on an CustomListView_ItemClick
I have the Application_Error Sub, in the Starter Service. I have an activity with a CustomListView and a button. On this Activity (on release mode) Doing Dim i as int ="abc" to force an error, in the button_click, the Starter Service Application_Error is fired. Doing Dim i as int...

i tried to implement my own UncaughtExceptionHandler wich fires the handlecrash event even in resumable subs, unfortunally im unable to show any gui object like a msgbox in my handlecrash sub (wich works in Application_Error).
i assume the looper of the UI thread crashed
B4X:
#If Java
import java.lang.Thread;
import java.lang.Thread.UncaughtExceptionHandler;
import anywheresoftware.b4a.BA;
public static void setExceptionHandler() {
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
String message = e.getMessage();
String stack = android.util.Log.getStackTraceString(e);
BA ba = processBA;
if (ba.subExists("handlecrash")) {
android.util.Log.e("CrashHandler", "UncaughtException ausgelöst");
android.util.Log.e("CrashHandler", "Fehlermeldung: " + message);
ba.raiseEvent(this, "handlecrash",message, stack);
}
}
});
}
#End If
Any ideas?
Cheers
Last edited: