fix: timeout error callback (#15)

This commit is contained in:
Daniel Rochetti
2024-02-27 07:48:17 -08:00
committed by GitHub
parent f4cfe04663
commit c88ea90c84

View File

@@ -349,7 +349,11 @@ func isSuccessResult(_ message: Payload) -> Bool {
func getError(_ message: Payload) -> FalRealtimeError? {
if message["type"].stringValue == "x-fal-error",
let error = message["error"].stringValue,
let reason = message["reason"].stringValue
let reason = message["reason"].stringValue,
// The timeout error is expected as the websocket endpoint returns that
// when no input has ben sent for a while. It's safe to ignore and should
// not trigger the onError callback of the client
error != "TIMEOUT"
{
return FalRealtimeError.serviceError(type: error, reason: reason)
}