-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HTTP error header #94
Comments
A lot of error messages are still reported with an HTTP status code 200 and a special XML tag "remark". I.e. the logic in JOSM wouldn't work out of the box as long as #56 is not yet implemented. At this time, the HTTP status code is not a reliable means to detect an error condition. Example: http://overpass-turbo.eu/s/3kA -> http status code 200, however a runtime error is contained in the XML response: For a good example on how to deal with Overpass API error messages, you might want to take a look at the respective logic in Overpass Turbo. |
Well, I understand and appreciate the good intent. But it is not possible, due to the nature of HTTP. Once the server has started to send content, it cannot change the status code or amend header lines. So the possibilities here are: Either embed error messages somehow in the XML (and JSON), or defer the delivery of content unless you are absolutely sure that no error could happen. The latter has the disadvantage of being up to twice as slow on all regular requests, which is a significant disadvantage, and to require quite a lot of extra memory on the server, which is also a significant disadvantage. Thus I decided to take the former approach. |
OK. Is it live already? |
Sure. Did you already try out the example I provided above or check the overpass turbo sources? All of this is already in production and works just fine. |
We implemented a workaround and parse the error from the response HTML, see https://josm.openstreetmap.de/changeset/8782/josm. |
Those error messages are nicely displayed in the error dialog. This is a workaround for drolbr/Overpass-API#94 git-svn-id: http://josm.openstreetmap.de/svn/trunk@8782 0c6e7542-c601-0410-84e7-c038aed88b3b
cool, thanks. I guess @don-vip can now finally close this ticket. |
Yeah sure. Thanks Simon :) |
Those error messages are nicely displayed in the error dialog. This is a workaround for drolbr/Overpass-API#94 git-svn-id: http://josm.openstreetmap.de/svn/trunk@8782 0c6e7542-c601-0410-84e7-c038aed88b3b
Those error messages are nicely displayed in the error dialog. This is a workaround for drolbr/Overpass-API#94 git-svn-id: https://josm.openstreetmap.de/svn/trunk@8782 0c6e7542-c601-0410-84e7-c038aed88b3b
Hi,
We have in JOSM an error handling mechanism for OSM API based on the presence of HTTP header named "Error", which contains the English error message of an erroneous API request.
See http://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/io/OsmServerReader.java?rev=7082#L172
Could it be possible to add the same HTTP header to errors raised by Overpass API?
It would allow to display error messages directly to JOSM users in a standard way :)
The text was updated successfully, but these errors were encountered: