On Wed, May 31, 2006 at 10:38:13PM +0300, Dan Pascu wrote: > On Wednesday 31 May 2006 21:28, Oleg Broytmann wrote: > > There is an item in the TODO to unify exceptions. But nobody's > > working on it now. Do you want to be the one? > > What is the intention regarding this?
> Is the plan There are no even plans, only daydreams. I'd be happy to discuss the thing and write down more concrete proposal or a plan. > to raise a single generic exception (say DatabaseError) with > specific details about the error, or the desire is to have a hierarchy of > exceptions like the backends have (DatabaseError, IntegrityError, > OperationalError, ...)? I have been thinking about the second option. Catch DB API driver's exceptions and translate them to SQLObject's exceptions. > Because a single generic exception will be pretty easy to add (just a > guess without looking at the code), while having a hierarchy will be more > complex as mappings between backend errors and sqlobject errors need to > be made and a common denominator needs to be found between backend > exceptions. The biggest problem is to translate exceptions. One DB API driver raises OperationError when another raises IntegrityError. We need to collect information about what exceptions every driver raise in what situations. > However even if the desire is to have a hierarchy of exceptions, it can > probably start with a generic exception which should be easy to add and > then expand by gradually adding the others over time as need arises > (i.e. all database errors in a backend map to the generic exception unless > some of them are specifically mapped to a more specific exception from > the sqlobject hierarchy) The problem that I see with the plan is that if SQLObject starts catching all exceptions from DB API drivers and translate them to a single exception that would mask low-level exceptions and it would be hard to monitor what driver raises what exception in what situation; logging would be of some help, but we need to add a lot of logging information; unfortunately Python does not have "exception chaining". The subproblem is that if the single high-level exception solves 60% of problems with exceptions nobody would like to work in the area further. Other than that it is a good plan! Oleg. -- Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss