If it's a code error rather than a data error, I don't see a problem with throwing an NPE. I'd save CayenneException for things that are environment-related.
Unit tests would be great. On 8/3/07, Kevin Menard <[EMAIL PROTECTED]> wrote: > > -----Original Message----- > > From: Mike Kienenberger [mailto:[EMAIL PROTECTED] > > Sent: Friday, August 03, 2007 12:07 PM > > To: [email protected] > > Subject: Re: Exceptions . . . > > > > Yes, I'm not saying we do it right. I'm just saying we correct things > > as we find them. I know of at least one instance where I was hit by > > something like this and the fix used was to detect the error at the > > initial point of failure. > > Gotcha. Are there any guidelines on this? I imagine throwing > CayenneException is preferred, but given that it's a checked exception, > that could mean rewriting interfaces. I'm a fan of throwing unchecked > exceptions if we can't do anything about the problem anyway. > > Also, should we be adding tests to check the exceptions are actually > thrown and pair them up with fail() calls? Or, has the approach been to > just introduce the exception and just make sure the existing test suite > passes? > > -- > Kevin > >
