lib/geo_code_repo.rb 🔗
@@ -16,7 +16,10 @@ class GeoCodeRepo
"https://geocoder.ca/",
tls: { verify_peer: true }
).aget(query: { json: 1, locate: q }).then { |res|
- JSON.parse(res.response)
+ json = JSON.parse(res.response)
+ raise "Geocode Failure" unless json["latt"] && json["longt"]
+
+ json
}
}.then(&GeoCode.method(:for))
end