From: Anders Borch Date: 2003-06-09T03:56:46+09:00 Subject: Re: [ANN] sql-serialize 0.0.3 Brian Candler wrote: > On Sun, Jun 08, 2003 at 05:15:00PM +0900, Anders Borch wrote: > >>>> rescue DBI::DatabaseError => dbe >>>> dbi.do("ROLLBACK") >>>> throw dbe >>>> end >>> >>> >>>Are you sure that's right??? I think you want to do a rollback for *all* >>>exceptions. That's one reason why the 'transaction do ... end' model might >>>be better. >> >>uhm... what are you thinking about specifically? > > > Absolutely any exception. NameError or ValueError for programming errors you > hadn't thought about. System errors if the database suddenly becomes > unreachable or you run out of RAM - anything. If you don't rollback changes > in those circumstances, then the half-transaction which you have already > written may get written later along with a subsequent transaction. > > B. > if a nameerror, typeerror or the like happens then hopefully my program will instantly crash and the user will scream at me until I fix it. I'm trying to catch as few exceptions as possible so I may see where they occur the hard way... it may just be me, but I find it easier to debug my code if it fails the instant an exception occurs. A. -- dc -e 4dd*od3*dddn1-89danrn10-dan3+ann6*dan*2*an13dn1+dn2-dn3+5*ddan2/9+an13nap