[OSM-dev] Inconsistent server error replies

Tom Hughes tom at compton.nu
Sun Sep 7 16:13:54 BST 2008


Till Harbaum / Lists wrote:

> Am Sonntag 07 September 2008 schrieb Tom Hughes:
>> A single line text message is clearly not appropriate for a 404 caused 
>> by using the wrong URL though as we have no idea if that came from a web 
>> browser or a program using the API and in the web browser case we want 
>> to send an HTML response.
 >
> If this happens while someone is accessing the api/xxx path on the server 
> we can be quite confident that it's not a browser but a program accessing 
> the api.

The 404 is generated by rails though, when it fails to find a route, and 
I'm not sure if you can easily make that conditioned on a partial match 
of the URL - you might be able to if you had some sort of explicit route 
that generated a 404 manually I guess.

>> In fact it's far more likely that it is a web browser as any program 
>> that is sending the wrong URL is presumably only ever going to do so for 
>> a short period while it is in development while a web user can type in 
>> the wrong URL at any time.
 >
> You mean there are more people trying to access the api branch on the server
> with the web browser than people with real api aware software trying
> to access the server and running into problems there?

The server doesn't really have a concept of an "API branch". It just has 
a set of rules for routing URLs to controllers which handle both API 
URLs and other URLs.

> IMHO the question is: What problems do we want to catch and address? Do
> we care for people accessing the api via their web browser and do we want to
> make sure they get useful error messages? Or do we want to make sure that
> software like josm and friends have a simple method of returning error 
> information?

The Error header is our officially sanctioned way of returning machine 
readable error information - it is what JOSM displays to the user for 
example. Yes I know we don't set it as often as we should.

I'm not especially bothered about providing browser friendly responses 
to API errors.

>> If you want to improve our error handling though then please do feel 
>> free - I'm sure you know where the repository is.
> I won't just patch other peoples software without having asked why things 
> are the way they are and without having come to the conclusion that my ideas
> are sufficient better than yours. You say that you think the 404 should remain
> valid html to make sure all browsers display it correctly and that ok with me.
> 
> Anyway, i can really live with the current state. I wasn't sure if this inconsistency
> is by purpose and thought that someone may want to think about this.

It's the way it is because that's how whoever wrote each piece of code 
did it - improvements are always welcome.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/




More information about the dev mailing list