Skip to content

Instantly share code, notes, and snippets.

@isaac-weisberg
Created October 19, 2019 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaac-weisberg/eddb02704fcc0dd9cf68b78ef6b3bf2e to your computer and use it in GitHub Desktop.
Save isaac-weisberg/eddb02704fcc0dd9cf68b78ef6b3bf2e to your computer and use it in GitHub Desktop.
extension DataDownloadServiceError: ErrorTitledSingularRepresentable {
var errorTitleSingular: ErrorTitledSingularType {
switch self {
case .noData:
return ErrorTitledSingular("Yikes!", "The server must be hung over tbh")
case .invalidResponseType:
return ErrorTitledSingular("Darn", "Ooops, guess we've goofed up")
case .networkError(let error):
return ErrorTitledSingular("Error", error.localizedDescription)
case .unexpectedStatusCode(let code):
return ErrorTitledSingular("Failure", "The server has responded with status code \(code)-- no idea like-- what?")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment