Skip to content

Commit

Permalink
fix: timeout error callback (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
drochetti authored Feb 27, 2024
1 parent f4cfe04 commit c88ea90
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/FalClient/Realtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit c88ea90

Please sign in to comment.