Skip to content

Commit

Permalink
Handle Socket Cancelled Error
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacakakpo1 committed Nov 28, 2023
1 parent 19b8915 commit ac4f84b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions TelnyxRTC/Telnyx/Models/TxError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public enum TxError : Error {
/// Socket is not connected. Check that you have an active connection.
case socketNotConnected
/// Socket connection was cancelled.
case socketCancelled
case socketCancelled(nativeError:Error)
}

/// The underlying reason of client setup configuration errors
Expand Down Expand Up @@ -131,8 +131,8 @@ extension TxError.SocketFailureReason: LocalizedError {
switch self {
case .socketNotConnected:
return "Socket connection cancelled."
case .socketCancelled:
return "Socket is not connected, check that you have called .connect() first."
case let .socketCancelled(nativeError):
return "Socket is connection is cancelled, try calling .connect again \(nativeError.localizedDescription)"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions TelnyxRTC/Telnyx/TxClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ extension TxClient : SocketDelegate {

func onSocketError(error: Error) {
Logger.log.i(message: "TxClient:: SocketDelegate onSocketError()")
let scoketError = TxError.socketConnectionFailed(reason: .socketCancelled(nativeError: error))
self.delegate?.onClientError(error: error)
if let txConfig = self.txConfig {
if(txConfig.reconnectClient){
Expand Down

0 comments on commit ac4f84b

Please sign in to comment.