On Aug 3, 2007, at 7:18 PM, Kevin Menard wrote:
> I imagine throwing
> CayenneException is preferred, but given that it's a checked
> exception,
> that could mean rewriting interfaces.
We certainly DO NOT want every method in Cayenne to throw checked
exceptions. Then it will be as "usable" as JDBC :-)
CayenneRuntimeException (and its two specialized subclasses -
ExpressionException and EJBQLException) and IllegalArgumentException
are two of my favorites.
For things like argument checking in the user-facing API,
IllegalArgumentException seems more appropriate than
CayenneRuntimeException.
Also I don't think we have too many methods in Cayenne (if any at
all) that throw checked CayenneException, requiring a try/catch. It
is always CayenneRuntimeException.
> I'm a fan of throwing unchecked exceptions if we can't do anything
> about the problem anyway.
Yep.
> Also, should we be adding tests to check the exceptions are actually
> thrown and pair them up with fail() calls? Or, has the approach
> been to
> just introduce the exception and just make sure the existing test
> suite
> passes?
It's been the later. But also because everybody wants to cut down
time writing unit tests, not because of some principle :-)
Andrus
This archive was generated by hypermail 2.0.0 : Fri Aug 03 2007 - 12:37:55 EDT