Added an associated type to the unknownError case of NetworkServiceError. Previously, the Error provided in the completion of the execution of a request was being thrown away if the response parameter was not a HTTPURLResponse. In some cases, these errors were internally mapped to a NetworkServiceError (noInternetConnection, timedOut, and cancelled), but now clients have access to all other errors that might occur (NSURLErrorBadURL, NSURLErrorCannotFindHost, NSURLErrorDNSLookupFailed, etc.).
Basically, instead of needing to manually map a lot more cases in this switch, we now pass the underlying error through so that clients can have a more descriptive explanation of what went wrong vs just getting back a NetworkServiceError.unknownError.
Added an associated type to the
unknownError
case ofNetworkServiceError
. Previously, theError
provided in the completion of the execution of a request was being thrown away if theresponse
parameter was not aHTTPURLResponse
. In some cases, these errors were internally mapped to aNetworkServiceError
(noInternetConnection
,timedOut
, andcancelled
), but now clients have access to all other errors that might occur (NSURLErrorBadURL
,NSURLErrorCannotFindHost
,NSURLErrorDNSLookupFailed
, etc.).Basically, instead of needing to manually map a lot more cases in this switch, we now pass the underlying error through so that clients can have a more descriptive explanation of what went wrong vs just getting back a
NetworkServiceError.unknownError
.