RhetTbull / locationator

A simple macOS menubar app that provides access to the macOS Location Services reverse geocoding API via a local web server as well as a command line tool.
MIT License
17 stars 0 forks source link

Handle errors for unknown locations #5

Open RhetTbull opened 8 months ago

RhetTbull commented 8 months ago

If a valid location is requested but the reverse geolocation server doesn't know about the address, the error kCLErrorDomain error 8 is returned. How should this be handled? Return an error? Return empty JSON? Return a valid response that is all null?

To replicate:

$ http  GET "http://localhost:8000/reverse_geocode?longitude=-118&latitude=85"
HTTP/1.0 500 Internal Server Error
Content-type: text/plain
Date: Sat, 14 Oct 2023 21:05:28 GMT
Server: SimpleHTTP/0.6 Python/3.11.6

Error Domain=kCLErrorDomain Code=8 "(null)"