Skip to content

Commit

Permalink
Handle error before unwrapping request data
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspaulmann authored Oct 14, 2016
1 parent 086852f commit 55ebb67
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/Alamofire+Promise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ extension Alamofire.DataRequest {
public func response() -> Promise<(URLRequest, HTTPURLResponse, Data)> {
return Promise { fulfill, reject in
response(queue: nil) { rsp in
if let a = rsp.request, let b = rsp.response, let c = rsp.data {
fulfill(a, b, c)
} else if let error = rsp.error {
if let error = rsp.error {
reject(error)
} else if let a = rsp.request, let b = rsp.response, let c = rsp.data {
fulfill(a, b, c)
} else {
reject(PMKError.invalidCallingConvention)
}
Expand Down

0 comments on commit 55ebb67

Please sign in to comment.