Re: How can I handle validation exception?

From: Νίκος Παράσχου (niparas..mail.com)
Date: Thu Mar 12 2009 - 05:03:07 EDT

  • Next message: Andrey Razumovsky: "Re: How can I handle validation exception?"

    Maybe I didn't state it clearly. When I said:

    "The problem is that commitChanges() doesn't throw directly a
    ValidationException so I cannot catch it in the catch block (it throws a
    CayenneRuntimeException)"

    I meant that I can't write the following because it can't be compiled
    (note that a ValidationException is caught):

    try {
            context.commitChanges();
    }
    catch(ValidationException vex) {
            // ...
    }

    That is what I meant by saying "directly" (to be able to write
    catch(ValidationException vex)).

    A ValidationException is thrown if there is a failure (so it is not a
    bug). Sorry for confusing you.

    My question is: How can I get the validationResult inside the block
    catch() if I write

    catch(Exception exc) {
            // ...
    }

    What is the suggested way of getting the failures produced during
    validation?

    Nikos

    Στις 12-03-2009, ημέρα Πεμ, και ώρα 10:22 +0200, ο/η Andrus Adamchik
    έγραψε:
    > On Mar 12, 2009, at 9:41 AM, Νίκος Παράσχου wrote:
    >
    > > The problem is that commitChanges() doesn't throw directly a
    > > ValidationException so I cannot catch it in the catch block (it
    > > throws a
    > > CayenneRuntimeException)
    >
    > Which version of Cayenne? This could be a bug.
    >
    > Andrus
    >



    This archive was generated by hypermail 2.0.0 : Thu Mar 12 2009 - 05:03:46 EDT