Closed matkoniecz closed 6 years ago
It would be useful also for timeouts.
The library already puts any information it gets from the HTTP error response into the exception, see OsmConnection line 333-345. Overpass in this case outputs an error message that includes the query and a pointer to what went wrong. So, this already works. See i.e. http://overpass-turbo.eu/s/xK8
Also, the actual query string is still on the stack when an exception is thrown. I.e.
String myFaultyQuery = "what??";
OverpassMapDataDao dao;
try {
dao.get(myFaultyQuery, (element, geometry) ->{ /* nevermind */ });
} catch(OsmApiException e) {
System.out.println("Oh hey, lets have a look at the query: " + myFaultyQuery);
System.out.println("But actually, this is more interesting: " + e.getDescription());
}
In case of 400 error (malformed query) it is usually useful to have text of executed query
I think that osmapi should add query text to exception data on encountering 400 code in Overpass response
In https://github.com/westnordost/StreetComplete/pull/954 I tried adding it to StreetComplete, but I think that it would be better to add it here.