Skip to content

Instantly share code, notes, and snippets.

@dodikk
Forked from gmertk/APIError.swift
Created May 3, 2017 08:40
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 dodikk/4c01c683f96d039e9698673cd161c74f to your computer and use it in GitHub Desktop.
Save dodikk/4c01c683f96d039e9698673cd161c74f to your computer and use it in GitHub Desktop.
enum APIError : ErrorType {
// Can't connect to the server (maybe offline?)
case ConnectionError(error: NSError)
// The server responded with a non 200 status code
case ServerError(statusCode: Int, error: NSError)
// We got no data (0 bytes) back from the server
case NoDataError
// The server response can't be converted from JSON to a Dictionary
case JSONSerializationError(error: ErrorType)
// The Argo decoding Failed
case JSONMappingError(converstionError: DecodeError)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment