fix: last resort for socket disconnect crash
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
70d572d93a
commit
16216ce6bf
|
|
@ -167,6 +167,7 @@ object RevoltAPI {
|
||||||
try {
|
try {
|
||||||
RealtimeSocket.connect(sessionToken)
|
RealtimeSocket.connect(sessionToken)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
try {
|
||||||
if (e is SocketException) {
|
if (e is SocketException) {
|
||||||
Log.d(
|
Log.d(
|
||||||
"RevoltAPI",
|
"RevoltAPI",
|
||||||
|
|
@ -176,15 +177,22 @@ object RevoltAPI {
|
||||||
Log.e("RevoltAPI", "WebSocket error", e)
|
Log.e("RevoltAPI", "WebSocket error", e)
|
||||||
}
|
}
|
||||||
RealtimeSocket.updateDisconnectionState(DisconnectionState.Disconnected)
|
RealtimeSocket.updateDisconnectionState(DisconnectionState.Disconnected)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Sentry.captureMessage("Error in socket error handling: $e")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
try {
|
||||||
if (e is InterruptedException) {
|
if (e is InterruptedException) {
|
||||||
Log.d("RevoltAPI", "Socket interrupted")
|
Log.d("RevoltAPI", "Socket interrupted")
|
||||||
} else {
|
} else {
|
||||||
Log.e("RevoltAPI", "WebSocket error", e)
|
Log.e("RevoltAPI", "WebSocket error", e)
|
||||||
}
|
}
|
||||||
RealtimeSocket.updateDisconnectionState(DisconnectionState.Disconnected)
|
RealtimeSocket.updateDisconnectionState(DisconnectionState.Disconnected)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Sentry.captureMessage("Error in socket error handling: $e")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue