dev@jsr311.java.net

Re: JSR311: exception mapping of wrapper exceptions

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 25 Jun 2008 10:09:57 -0400

On Jun 25, 2008, at 8:45 AM, Bill Burke wrote:

> 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());
>
> }
>
I prefer #1, it seems more direct.

Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.