users@jersey.java.net

[Jersey] Mapping exceptions thrown from JaxB bean methods

From: <yaegor_at_gmail.com>
Date: Thu, 2 Feb 2012 20:18:38 +0000 (GMT)

I have an ExceptionMapper for my custom exception (which extends
RuntimeException).
When my exception is thrown from a resource method (annotated with
@Path ), it is correctly mapped through my instance of ExceptionMapper.

However, when my exception is thrown from @XmlAttribute-annotated
method in a JaxB bean (which in turn is returned by a resource method),
no mapping occurs.

Is this by design?


The current way to affect errors returned from JaxB methods seems to
wrap them into WebApplicationException which seems sub-optimal.

Is there any other way to map the exceptions from JaxB bean methods?