cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Νίκος Παράσχου <nipar...@gmail.com>
Subject How to know what the exact problem of CayennRuntimeException was?
Date Thu, 19 Mar 2009 10:56:30 GMT
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


Mime
View raw message