forked from ishkawa/APIKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPIError.swift
More file actions
28 lines (20 loc) · 938 Bytes
/
Copy pathAPIError.swift
File metadata and controls
28 lines (20 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Foundation
public enum APIError: ErrorType {
/// Error of `NSURLSession`.
case ConnectionError(NSError)
/// Invalid `Request.baseURL`.
case InvalidBaseURL(NSURL)
/// Error in `Request.configureURLRequest()`.
case ConfigurationError(ErrorType)
/// Error in `RequestBodyBuilder.buildBodyFromObject()`.
case RequestBodySerializationError(ErrorType)
/// Indicates `NSHTTPURLResponse.statusCode` is not contained in `Request.statusCode`.
/// Second associated value is return value of `errorFromObject()`.
case UnacceptableStatusCode(Int, ErrorType)
/// Error in `ResponseBodyParser.parseData()`.
case ResponseBodyDeserializationError(ErrorType)
/// Indicates `responseFromObject()` or `errorFromObject()` returned nil.
case InvalidResponseStructure(AnyObject)
/// Failed to cast `URLResponse` to `NSHTTPURLResponse`.
case NotHTTPURLResponse(NSURLResponse?)
}