Skip to content

Commit

Permalink
Merge pull request #3 from thomaspaulmann/patch-1
Browse files Browse the repository at this point in the history
Handle error before unwrapping request data
  • Loading branch information
mxcl authored Oct 15, 2016
2 parents 086852f + 55ebb67 commit c7ae494
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 c7ae494

Please sign in to comment.