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