Skip to content

Commit

Permalink
[Issue #128] Cancelling download now creates error in NSURLErrorDomain.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnoon committed Aug 22, 2016
1 parent 052dbd2 commit b2eb100
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/ImageDownloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ public class ImageDownloader {
let error: NSError = {
let failureReason = "ImageDownloader cancelled URL request: \(URLRequest.URLString)"
let userInfo = [NSLocalizedFailureReasonErrorKey: failureReason]
return NSError(domain: Error.Domain, code: NSURLErrorCancelled, userInfo: userInfo)
return NSError(domain: NSURLErrorDomain, code: NSURLErrorCancelled, userInfo: userInfo)
}()

return Response(request: URLRequest, response: nil, data: nil, result: .Failure(error))
Expand Down
4 changes: 2 additions & 2 deletions Tests/ImageDownloaderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ class ImageDownloaderTestCase: BaseTestCase {
XCTAssertTrue(response?.result.isFailure ?? false, "result should be a failure case")

if let error = response?.result.error {
XCTAssertEqual(error.domain, Error.Domain, "error domain should be com.alamofire.error")
XCTAssertEqual(error.domain, NSURLErrorDomain, "error domain should be com.alamofire.error")
XCTAssertEqual(error.code, NSURLErrorCancelled, "error code should be cancelled")
}
}
Expand Down Expand Up @@ -557,7 +557,7 @@ class ImageDownloaderTestCase: BaseTestCase {
XCTAssertTrue(response1?.result.isFailure ?? false, "response 1 result should be a failure case")

if let error = response1?.result.error {
XCTAssertEqual(error.domain, Error.Domain, "error domain should be com.alamofire.error")
XCTAssertEqual(error.domain, NSURLErrorDomain, "error domain should be com.alamofire.error")
XCTAssertEqual(error.code, NSURLErrorCancelled, "error code should be cancelled")
}

Expand Down

0 comments on commit b2eb100

Please # to comment.