Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.

Error Handling

Roman Baitaliuk edited this page Jan 29, 2018 · 3 revisions

ClusterWS Swift Client provides an easy interface to handle errors.

Handling errors

To handle errors you have to listen delegate method onError:

func onConnect() {}
    
func onDisconnect(code: Int?, reason: String?) {}
    
func onError(error: Error) {
    if let error = error as? CWSErrors {
        /**
            Handling ClusterWS client / server errors
        */
        print(error.localizedDescription)
    } else {
        /**
            Handling web socket / connection errors
        */
        print(error.localizedDescription)
    }
}
Clone this wiki locally