How to know what the exact problem of CayennRuntimeException was?

From: Νίκος Παράσχου (niparas..mail.com)
Date: Thu Mar 19 2009 - 06:56:30 EDT

  • Next message: Eric Lazarus: "$ to Build a Rich/Desktop UI for an Open Source system based on Cayenne"

    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



    This archive was generated by hypermail 2.0.0 : Thu Mar 19 2009 - 06:57:07 EDT