Created
May 14, 2019 07:18
-
-
Save Mintri1199/1c98594fd6279377d7047ff04e4cccd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fileprivate func newHandleNetworkResponse(_ response: HTTPURLResponse) -> Result<String, NetworkReponse> { | |
switch response.statusCode { | |
case 200...299: return Result.success("Success") | |
case 401...500: return Result.failure(.authenticationError) | |
case 501...599: return Result.failure(.badRequest) | |
case 600: return Result.failure(.outdated) | |
default: return Result.failure(.failed) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment