cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Moroski" <jmoro...@docfinity.com>
Subject Unchecked exception handling
Date Fri, 02 Nov 2007 20:15:40 GMT
I have a need (a perceived need at least) to be able to throw unchecked
exceptions from a web service method.
 
For instance, a call to a method saveCategory(dto) could throw an
EntityNotFoundException, a ValidationException, an
InsufficientRightsException, a DataAccessException, etc.
 
Rather than make these all checked exceptions and have to catch and
throw at all the various layers (to handle things like auditing and
transaction rollback and license revocations) I'd like to define the
saveCategory method to throw these unchecked exceptions.  I realize that
unchecked exceptions don't have to go in the throws clause, but it is a
quick and easy way to get the exceptions into the wsdl.
 
I know that web services aren't supposed to play well with
RuntimeExceptions, but why couldn't I create a custom fault handler to
catch runtime exceptions and wrap a checked exception around it?  That
way the saveCategory method can stay readable (as well as the manager
and DAO layers), and CXF can still send back a checked exception.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message