This is useful when differentiating different error responses. Example:
if let e = error {
switch e {
case ErrorResponse.Error(400, _, _): responseLabel.text = "Unknown error"
case ErrorResponse.Error(403, _, _): responseLabel.text = "Not logged in"
default: responseLabel.text = "\(e)"
}
}
The existing error is straight from Alamofire and only includes the HTTP
status code in the body of the message (not broken out as a separate value).
It also does not include the response body, which may be useful.
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.