cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Νίκος Παράσχου <nipar...@gmail.com>
Subject Re: How can I handle validation exception?
Date Thu, 12 Mar 2009 09:03:07 GMT
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
> 


Mime
View raw message