Hello Paul,

if I understood you right, than you want to add method to the class Status to save the exception in the status object. But the Status objects are immutable as all metadata. So this won't work.

best regards
  Stephan

Paul J. Lucas schrieb:
I would like to be able to have code like:

    try {
        // ...
    }
    catch ( SomeException e ) {
        response.setStatus( CLIENT_ERROR_BAD_REQUEST, e );
    }

That is that you can pass a Throwable to setStatus() and that the Status class have the additional methods of:

    void setThrown( Throwable t );
    Throwable getThrown();

The default implementation of the response that gets returned to the client will simply do an:

    t.getMessage()

and include that as the textual error message. However, if I implement my own StatusService, I have full access to the exception. In my case, I'd like to return an XML entity containing an XML-ized version of the exception's stack trace.

- Paul

Reply via email to