Skip to content

Commit

Permalink
Remove references to NSError (#23)
Browse files Browse the repository at this point in the history
- [x] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](../CONTRIBUTING.md).

This pull request includes (pick all that apply):

- [ ] Bugfixes
- [ ] New features
- [x] Breaking changes
- [ ] Documentation updates
- [ ] Unit tests
- [ ] Other

### Summary
- Remove references to `NSError`, use `Error` instead.

### Implementation
- Remove unnecessary casting to `NSError`.

### Test Plan
- Run `rake test`
  • Loading branch information
eneko authored Aug 1, 2017
1 parent da64dc4 commit 13304d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Master

#### Breaking
- Remove unnecessary casting to `NSError` on `SessionTaskCompletion`.
- `XMLNode.children` is no longer optional, defaults to empty array.

#### Enhancements
Expand Down
8 changes: 4 additions & 4 deletions Sources/Conduit/Networking/URLSessionClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public typealias SessionTaskCompletion = (Data?, URLResponse?, NSError?) -> Void
public typealias SessionTaskCompletion = (Data?, URLResponse?, Error?) -> Void
public typealias SessionTaskProgressHandler = (Progress) -> Void

fileprivate typealias SessionCompletionHandler = (URLSession.AuthChallengeDisposition, URLCredential?) -> Void
Expand Down Expand Up @@ -145,7 +145,7 @@ public struct URLSessionClient: URLSessionClientType {
taskUploadProgresses[task.taskIdentifier] = nil
}

completionHandler?(taskResponse.data, taskResponse.response, taskResponse.error as NSError?)
completionHandler?(taskResponse.data, taskResponse.response, taskResponse.error)
}

func registerCompletionHandler(taskIdentifier: Int,
Expand Down Expand Up @@ -284,7 +284,7 @@ public struct URLSessionClient: URLSessionClientType {
switch middlewareProcessingResult {
case .error(let error):
self.urlSession.delegateQueue.addOperation {
completion(nil, nil, error as NSError)
completion(nil, nil, error)
}
return
case .value(let request):
Expand Down Expand Up @@ -366,7 +366,7 @@ public struct URLSessionClient: URLSessionClientType {
// If for some reason the client isn't retained elsewhere, it will at least stay alive
// while active tasks are running
self.activeTaskQueueDispatchGroup.leave()
completion(data, response, error as NSError?)
completion(data, response, error)
}

return dataTask
Expand Down

0 comments on commit 13304d8

Please sign in to comment.