Skip to content

Instantly share code, notes, and snippets.

@gmoraleda
Created November 15, 2018 12:36
Show Gist options
  • Save gmoraleda/67147ef8c051f454b049e28bd46db312 to your computer and use it in GitHub Desktop.
Save gmoraleda/67147ef8c051f454b049e28bd46db312 to your computer and use it in GitHub Desktop.
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