Skip to content

Commit

Permalink
fix sytax for test case
Browse files Browse the repository at this point in the history
  • Loading branch information
beforeold committed Jan 22, 2019
1 parent 5bd90f2 commit 51300ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MapboxGeocoder/MBGeocoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,12 @@ open class Geocoder: NSObject {
return URLSession.shared.dataTask(with: request) { (data, response, error) in

guard let data = data else {
errorHandler(error)
return
if let error = error as? NSError {
errorHandler(error)
} else {
errorHandler(NSError(domain: MBGeocoderErrorDomain, code: -1024, userInfo: [NSLocalizedDescriptionKey : "unexpected error", NSDebugDescriptionErrorKey : "this error happens when data task return nil data and nil error, which typically is not possible"]))
}
return
}
let decoder = JSONDecoder()

Expand Down

0 comments on commit 51300ab

Please sign in to comment.