Skip to content
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

Closed
don-vip opened this issue Jun 1, 2014 · 7 comments
Closed

Add HTTP error header #94

don-vip opened this issue Jun 1, 2014 · 7 comments
Labels

Comments

@don-vip
Copy link

don-vip commented Jun 1, 2014

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 :)

@mmd-osm
Copy link
Contributor

mmd-osm commented Jun 1, 2014

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:
<remark> runtime error: open64: 0 Success - reconstruct_items::1 </remark>

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.

@drolbr
Copy link
Owner

drolbr commented Jun 2, 2014

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.

@don-vip
Copy link
Author

don-vip commented Jun 2, 2014

OK. Is it live already?

@mmd-osm
Copy link
Contributor

mmd-osm commented Jun 3, 2014

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.

@simon04
Copy link

simon04 commented Sep 22, 2015

We implemented a workaround and parse the error from the response HTML, see https://josm.openstreetmap.de/changeset/8782/josm.

simon04 added a commit to JOSM/josm that referenced this issue Sep 22, 2015
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
@mmd-osm
Copy link
Contributor

mmd-osm commented Sep 22, 2015

cool, thanks. I guess @don-vip can now finally close this ticket.

@don-vip
Copy link
Author

don-vip commented Sep 22, 2015

Yeah sure. Thanks Simon :)

@don-vip don-vip closed this as completed Sep 22, 2015
michaelzangl pushed a commit to michaelzangl/josm that referenced this issue Jan 2, 2016
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
floscher pushed a commit to floscher/josm that referenced this issue Mar 28, 2018
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants