dev@jsr311.java.net

Re: JSR311: exception mapping of wrapper exceptions

From: Stephan Koops <Stephan.Koops_at_web.de>
Date: Wed, 25 Jun 2008 15:34:12 +0200

In my understanding it is the work of the message body writer to
serialize the objects, read from the database (or whereever) *in the
resource method*. So there could be no exception before start the
writing. And after the start of the writing, there is no reaction
possible, only stop transmission and close the stream, IMO.

When do the exception occur?

best regards
   Stephan

Bill Burke schrieb:
> A few Resteasy users came across a problem with exception mapping and
> wrapper exceptions like: EJBException, RemoteException,
> EJBTransactionRollbackException, hibernate BatchedException.
>
> When wrapper exceptions exist, then it sort of makes ExceptionMapper
> not very useful. I was thinking of two ways to solve this:
>
> #1 Rename and expand MessageBodyWorkers so that you can look up any
> provider
>
> #2 Define a MapCauseException. ExceptionMappers would throw this if
> they want JAX-RS to remap an inner exception: i.e.:
>
> Response toResponse(EJBException ex) {
>
> throw new MapCausepException(ex.getCause());
>
> }
>
> Thoughts?
>