Created
November 15, 2018 12:36
-
-
Save gmoraleda/67147ef8c051f454b049e28bd46db312 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
enum ErrorCode: Int, Error, Codable { | |
case noError = 0 | |
case noConnection = 401 | |
case userNotFound = 404 | |
// ... | |
var localizedDescription: String? { | |
switch self { | |
case .noError: | |
return nil | |
case .noConnection: | |
return "No connection to the server" | |
case .userNotFound: | |
return "User not found in the database" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment