I wish if AsyncStream catch IOException so we can read and handle or filter out exceptions like
B4X:
java.net.SocketException: Connection reset
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:126)
at anywheresoftware.b4a.randomaccessfile.AsyncStreams$AIN.run(AsyncStreams.java:232)
at java.base/java.lang.Thread.run(Thread.java:834)
it refers that AsyncStreams.java on line 232 throw this error which after I check the github source I see it refers to this method
which throws this IOException we can simply pass a parameter in the event that carry the exception as string and handle it as needed without throw this exception in the logger
There is an '_error' event raised by both the background input and output streams that should set LastException that should let your program see if an exception occurs in the stream handling as well as printing it to the logs. I don't know if it will trap all errors but it is worth a try.
There is an '_error' event raised by both the background input and output streams that should set LastException that should let your program see if an exception occurs in the stream handling as well as printing it to the logs. I don't know if it will trap all errors but it is worth a try.
I tried this method to catch error event astreams_Error and logging "Log(LastException)" but this is not the point this will print the exception in the terminal twice. I mean to avoid throwing exceptions to the logger and I show them if I needed currently the logger will print any uncatched exceptions in the terminal which by time flooded the terminal with unnecessary messages