oxen-io / session-android

A private messenger for Android.
https://getsession.org
GNU General Public License v3.0
1.73k stars 165 forks source link

[SES-1930] Catch HTTP exceptions from threads #1491

Closed AL-Session closed 1 month ago

AL-Session commented 1 month ago

Contributor checklist


Description

Exceptions thrown from HTTP.kt have been causing crashes - specifically when the device is not connected to the network (HTTPNoNetworkConnection) or if an operation failed due to a timeout (HTTPRequestFailedException). This PR simply catches the exceptions and logs them in the ThreadUtil.queue functions to prevent a crash.

bemusementpark commented 1 month ago

In the stack trace it doesn't go through ThreadUtil#queue, but queue$lambda$0 the anonymous function, which is kind of a clue apparently, cause that's called asynchronously by ThreadPoolExecutor

at org.session.libsignal.utilities.ThreadUtils.queue$lambda$0 (ThreadUtils.kt:18)