: >   throw new SolrException( 400, "missing parameter: "+p );
: >
: > This will return 400 with a message "missing parameter: " + p.
: >
: > Exceptions or SolrExceptions with code=500 || code<100 are sent to
: > client with status code 500 and a full stack trace.
:
: That all seems ideal to me, but there had been talk in the past about
: formatted responses on errors.  Given that even update handlers can
: return full responses, I don't see the point of formatted (XML,etc)
: response bodies when an exception is thrown.

I can't find the thread at the moment, but as I recall, there was once
some conscensus that while errors should definitely be returned with
appropriate HTTP status codes, and the exception message should be
included in the status line, the QueryResponseWriter whould be given an
opportunity to format the Exception -- the rationale being that all
clients should check the HTTP status code, and if it's not 2xx, then they
should use the status message for simple error reporting, but if they want
more details they can check the Content-Type of the response and if it
matches what they were expecting, they can get the detailed error info
from it.

So if you are writing a python client and expecting python back, the stack
trace will be formated in python so you can easily parse it ... if you are
expecting XML back, the stack trace will be formated in XML, etc...

i think the only time the dispatcher should return an html (or plain text)
error page is if it encounters an exception before it can extract the
writer to use from the request params, or if the exception is in the
ResponseWriter itself.

This would be one reason to leave getException() in the SolrQueryResponse
interface ... it let's us keep the API the same for ResponseWriters (no
need to add a new writeErrorPage(Exception) method) ... another advantage
to keeping that encapsalation is it gives the ResponseWriters the ability
to generate pages which contain the partial results from the
RequestHandler (prior to encountering an exception) as well the Exception
itself.


-Hoss

Reply via email to