Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix missing of errorHandler #175

Merged
merged 3 commits into from Jan 29, 2019
Merged

fix missing of errorHandler #175

merged 3 commits into from Jan 29, 2019

Conversation

beforeold
Copy link
Contributor

@beforeold beforeold commented Jan 21, 2019

in case that the data task fails, the geocoder still need to call back with errorHandler, otherwise the caller may not complete.

Fixes #170.

@@ -268,7 +268,10 @@ open class Geocoder: NSObject {
request.setValue(userAgent, forHTTPHeaderField: "User-Agent")
return URLSession.shared.dataTask(with: request) { (data, response, error) in

guard let data = data else { return }
guard let data = data else {
errorHandler(error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch. Would you mind adding a test for this case? Also, you have to return the error as? NSError

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, i will try this later today.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see 51300ab refers to a test case, but I don't see one. Is this still something you could add?

Thanks for the PR, this is important missing functionality.

@beforeold
Copy link
Contributor Author

@frederoni will you please review this pr once again?

@frederoni frederoni merged commit d341179 into mapbox:master Jan 29, 2019
@beforeold beforeold deleted the patch-1 branch February 11, 2019 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants