GIScience / openrouteservice

🌍 The open source route planner api with plenty of features.
https://openrouteservice.org
GNU General Public License v3.0
1.33k stars 379 forks source link

"Undefined" error returned when route not found #601

Closed LRitzdorf closed 4 years ago

LRitzdorf commented 4 years ago

Hello,

I've written a program that uses the ORS Python API to retrieve and store routing information for later use. I tested it on 9/15/2019, and everything worked correctly. Upon running the program again on 10/12/2019, however, it seems that a recent update has changed how error handling works on the ORS servers.

Previously, if a route could not be found between two locations, an HTTP 404 response would be returned, along with the internal error code 2010. Now, the HTTP response code is 500 (an unknown server error), and the internal code is 2099 (also an unknown error). This is a rather unhelpful result, as it is unclear what exactly has happened, or how the error might be resolved.

The same error appears in the online graphical interface (maps.openrouteservice.org), which displays the following message:

Error
Code undefined: undefined

Further research led me to #144, which seems to be very similar to the current issue.

Can route-not-found errors be handled more descriptively? Returning to the previous error numbering scheme seems best, but I realize that this may not be the case - after all, the numbering must have been changed for a reason.

Thanks!


Edit: At the very least, a more descriptive error message would be appreciated. The current message is simply None in the Python API.

aoles commented 4 years ago

I can confirm this. In fact, when the start-/endpoint is not found the error code returned by the API is 2099 UNKNOWN rather than the more specific one 2010 POINT_NOT_FOUND or 2009 ROUTE_NOT_FOUND. Consider the following example:

Screenshot_2019-10-29 Openrouteservice Maps(1)

The corresponding JSON response from https://api.openrouteservice.org/v2/directions/driving-car for this request is

{"error":{"code":2099,"message":null},"info":{"engine":{"version":"5.0.2","build_date":"2019-09-20T13:57:05Z"},"timestamp":1572344656599}}
rabidllama commented 4 years ago

Things that need to be done are: 1 - make it so that when there is no search radius parameter in the app.config, a default value is used 2 - I also see the the erro message text is written twice, so this should be modified to make sure it only comes back once.

aoles commented 4 years ago

Thank you @MichaelsJP for looking into the issue!

aoles commented 4 years ago

Fixed via https://github.com/GIScience/openrouteservice/issues/144.