Improved error mapping in the Amiibo Live client in the library target.
This commit is contained in:
@@ -372,21 +372,28 @@ private extension AmiiboLiveClient {
|
||||
throw AmiiboServiceError.decoding
|
||||
case let urlError as URLError:
|
||||
switch urlError.code {
|
||||
case .cancelled:
|
||||
throw AmiiboServiceError.cancelled
|
||||
case .cannotParseResponse:
|
||||
throw AmiiboServiceError.decoding
|
||||
case .cannotFindHost,
|
||||
.cannotConnectToHost,
|
||||
.dataNotAllowed,
|
||||
.dnsLookupFailed,
|
||||
.internationalRoamingOff,
|
||||
.networkConnectionLost,
|
||||
.notConnectedToInternet,
|
||||
.secureConnectionFailed,
|
||||
.timedOut:
|
||||
throw AmiiboServiceError.notAvailable
|
||||
default:
|
||||
throw AmiiboServiceError.unknown
|
||||
throw AmiiboServiceError.unknown(String(describing: urlError))
|
||||
}
|
||||
default:
|
||||
throw AmiiboServiceError.unknown
|
||||
throw AmiiboServiceError.unknown(String(describing: clientError.underlyingError))
|
||||
}
|
||||
default:
|
||||
throw AmiiboServiceError.unknown
|
||||
throw AmiiboServiceError.unknown(String(describing: error))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user