[DALI] error documents

Norman Gray norman at astro.gla.ac.uk
Tue Oct 30 12:26:42 PDT 2012


Pat and all, hello.

On 30 Oct 2012, at 19:01, Patrick Dowler <patrick.dowler at nrc-cnrc.gc.ca> wrote:

> "if the service normally returns results in VOTable format, errors should also 
> be expressed with VOTable error documents"
> 
> "if a service does not use VOTable, it may use text/plain error documents" 

> So, this is just relaxing the language a bit to permit text/plain error 
> documents in specific DAL services. Comments?

Why not just relax the language to permit any format in the error document, but suggest good practice?

This would leave it open to the server to use a suitable heuristic to determine which content type to use in an error response.  A suitable algorithm might be:

  * If the client has an Accept header on the request, then use a response content type which is compatible with this
  * If not, then use the same type which the service would have produced if the request had been successful
  * Or else pick what seems a good idea in the context.

This would allow an AJAX-ish client to say that it wants a JSON response, for example. Such a client could say it prefers application/x-votable+xml to application/json to text/plain, so it gets a VOTable if the request works, and a JSON response (if the server can do that) if not.

 There'd be no need to _require_ services to produce one format or another (and for what it's worth, the HTTP spec is also deliberately vague on what MIME type any error response should be), but giving this freedom allows services to provide client-friendlier responses if they're capable of that.

All the best,

Norman


-- 
Norman Gray  :  http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK



More information about the dal mailing list