Jorge Godoy wrote: > Hi! > > I'm writing a decorator and I need to trap some exceptions generated from > SQLObject (actually they are generated by the driver it is using). I had this > on my code, working: > > try: > ... > except model.<CLASS_NAME>._connection.module.<EXCEPTION_NAME>:
I'm glad you asked. I had the same problem (http://trac.turbogears.org/turbogears/wiki/SqlObjectGotchas). My best result was hub.hub.getConnection().module.IntegrityError, which was just too wordy to be the optimal solution. But it appeared to me that the ORMs don't shine here (it's apparently a bit less complicated using engine.dbapi().IntegrityError in SQLAlchemy). I'd really like to have a way to write this in a more straightforward fashion, because I need to catch certain database exceptions like constraint violations. Maybe ideally using something like: try: ... except hub.IntegrityError, e: ... -- Gerhard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~----------~----~----~----~------~----~------~--~---

