-
Notifications
You must be signed in to change notification settings - Fork 48
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
Conversation
MapboxGeocoder/MBGeocoder.swift
Outdated
@@ -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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@frederoni will you please review this pr once again? |
in case that the data task fails, the geocoder still need to call back with errorHandler, otherwise the caller may not complete.
Fixes #170.