In my application I'd like db related errors that are encountered when
using mapped classes to have better exceptions that make more sense in
the context of my program.  Where is the best place to put this
stuff?

For example, say I have a table with a single primary_key column and I
have a class MyData mapped to that table.  If someone were to try to
make and flush a MyData(someDuplicateEntry) instance they'd get an
ugly sqlalchemy exception.  I'd rather they get, say, an
AlreadyExistsException() or something to that effect.  Now, I can wrap
each flush with a try/except block, or have the __init__ method of the
class do a check during instantiation, but I'm wondering if there is
some better way to do it.

Perhaps a way to map SqlerrorA to throw ExceptionA and SqlerrorB to
throw ExceptionB.

Thanks,
Ron


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to