users@jersey.java.net

[Jersey] QueryParamException Wrapping

From: Pedro Nuno Santos <pedro-nuno-santos_at_telecom.pt>
Date: Thu, 31 Jul 2014 18:26:43 +0100

Hi,

I have several classes which I use as query parameters (that have a constructor with the single String argument). When parsing the string I also perform transformations/validations which can result in an exception being thrown. I would like for the exception mapper I created for those exception to handle them, whoever it seems that when creating a query parameter object jersey wraps any exception in a ExtractorException which is itself wrapped in a ParamException.QueryParamException.

My question is, is there a way to disable this wrapping behaviour? (behaviour like this seems counter-intuitive to the basic utility of exception mappers which is: create exception + exception mapper as a standard for error handling - is there any special reason why the exception are wrapped in ParamException.QueryParamException?)

Right now I've created an exception mapper for ParamException.QueryParamException and depending on the cause I return different responses, but it would be "cleaner" if I were able to disable the wrapping...


Cheers,
Pedro S.