Rob Heittman <rob.heittman <at> solertium.com> writes:
 
> In our current WebDAV and VFS stack, we have exception types that map 
> straightforwardly to likely resource-related HTTP error status codes 
> (NotFoundException, ConflictException...).  It is much
> easier, more testable, more maintainable, and more readable to simply
> throw ConflictException
> wherever a condition is detected that causes 409 Conflict status, than
> to do a lot of error catching and
> status propagation locally in the code.


I have done something similar in my project but the exception hierarchy is 
unchecked. This allows me to use the same set of exceptions in my DAO code,
and Controller code and not have to add 'throws RestletException' everywhere. 
Also I can code against interfaces that know nothing about Restlets so don't
have to add 'throws RestletException' even though the implementation might
throw a derived exception like NotFoundException. I also have a StatusService
that converts these exceptions to the appropriate HTTP error code and it 
works wonderfully.

Sumit

Reply via email to