cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <>
Subject Re: How to know what the exact problem of CayennRuntimeException was?
Date Thu, 19 Mar 2009 16:48:00 GMT
Normally, you can unroll the stack trace and find out what caused the
problem, especially if there is an SQLException underneath.

If someone wanted to categorize the various uses of
CayenneRuntimeException and subclass it to throw some specific errors
under specific situations, I don't think anyone would mind.   I know
we already have subclasses for FaultFailureExceptions and
OptimisticLockingExceptions.  Just keep in mind that often the problem
is hidden inside the SqlException, and what you'd have to do is
somehow parse that information back out.  I'm not sure if that's a
useful thing for Cayenne to be trying to maintain.

2009/3/19 Νίκος <>:
> Hello,
> When I try to commit something and Cayenne cannot communicate with the
> data node (because internet connection is broken or the DBMS server is
> down), a CayenneRuntimeException is thrown.
> A CayenneRuntimeException is also thrown when commiting duplicate
> entries in PK fields.
> If I make a commit and get a CayenneRuntimeException, how can I know
> what the exact problem was? DBMS server is down, internet connection is
> down or duplicate entry insertion?
> I know that there is a description of the exact problem in the Exception
> object, but what if I want to give my own message to the user (in some
> other language)?
> Wouldn't it be better if different exceptions were thrown for
> Communication Failures and Duplicate Entries? (and whatever else
> necessary)
> For example:
> catch(CommunicationFailureException exc) {
>        // Here I can write my own communication failure message.
> }
> catch(DuplicateEntriesException exc) {
>        // Here I can write my own duplicate entries failure message.
> }
> Thank you,
> Nikos

View raw message