Created
May 10, 2019 12:09
-
-
Save JeremyXue77/81ffb132c09aa066f59d8fa894898f54 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 handleNetworkResponse(_ response: HTTPURLResponse) -> Result<String>{ | |
switch response.statusCode { | |
case 200...299: return .success | |
case 401...500: return .failure(NetworkResponse.authenticationError.rawValue) | |
case 501...599: return .failure(NetworkResponse.badRequest.rawValue) | |
case 600: return .failure(NetworkResponse.outdated.rawValue) | |
default: return .failure(NetworkResponse.failed.rawValue) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment