I've only really recently come to explore the potential of the exception
mapping functionality and it's excellent.  When combined with the
integration with Hibernate Validator it's extremely powerful and flexible
for serverside validation, and it has massively reduced the amount of
custom code I need.  I love the fact I can return an object from the method
and RestEasy will jaxb marshal it to the right content type for me even
though it's in an error state!

One slight bugbear remains though - the exception is logged in the JBoss
logs as an error (with a stack trace) even though I've caught and handled
it in the handler.  Is there any way to avoid this? Ideally, having handled
it in an ExceptionMapper I'd like that to be the end of it - I can log it
myself there if I want to.  The fact that it's still logged by JBoss also
implies that it's still considered "uncaught"?   I understand there's a
distinction between caught and uncaught exceptions, in that uncaught
exceptions result in the Session object being invalidated (as its
consistency can no-longer be ensured).  If that's the case, and the
ConstraintViolationException is not being caught by the ExceptionMapper, it
could be the cause of some JPA 'detatched entity' errros that I'm seeing...

I have a second ExceptionMapper question too :)

Ideally I'd like to deploy a sort of catch-all mapper that handles any
exceptions that have not been picked-up by a more specific handler.  This
way I can catch and handle constraint violations and my own application
exceptions, but also provide something more intelligable for unexpected
system exceptions.  I thought I might be able to drop-in an
ExceptionMapper<Exception> and the Provider process would only pick it up
if there wasn't anything more specific, but it doesn't seem to work that
way.  Am I missing something, or hoping for too much?

Thank you for the excellent framework, it's a pleasure to use!
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to