Skip to content

Commit

Permalink
Map .errorInternet for WS close codes 1011 - 1015
Browse files Browse the repository at this point in the history
  • Loading branch information
tagavari committed Aug 7, 2022
1 parent f0ae5e8 commit dda25c0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions AirMessage/Connection/Connect/DataProxyConnect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,19 @@ class DataProxyConnect: DataProxy {
//Map the error code
let localError: ServerState
switch code {
case .normalClosure:
case .normalClosure, .unexpectedServerError:
localError = .errorInternet
case .protocolError, .policyViolation:
localError = .errorConnBadRequest
case .unknown(let rawCode):
//Custom AirMessage codes
switch rawCode {
//Other WebSocket close codes
case 1012, //Server error
1013, //Service restart
1014, //Try again later
1015: //Bad gateway
localError = .errorInternet
//Custom AirMessage codes
case ConnectCloseCode.incompatibleProtocol.rawValue:
localError = .errorConnOutdated
case ConnectCloseCode.accountValidation.rawValue:
Expand Down

0 comments on commit dda25c0

Please sign in to comment.