Re: Can I map "raise XXX" to some custom python exceptions?
От | W. Matthew Wilson |
---|---|
Тема | Re: Can I map "raise XXX" to some custom python exceptions? |
Дата | |
Msg-id | BANLkTikOuawtXKvOokuUvJBDRMuSyO+W7Q@mail.gmail.com обсуждение исходный текст |
Ответ на | Can I map "raise XXX" to some custom python exceptions? ("W. Matthew Wilson" <matt@tplus1.com>) |
Ответы |
Re: Can I map "raise XXX" to some custom python exceptions?
|
Список | psycopg |
On Sun, Jun 19, 2011 at 1:02 PM, Dan Halbert <halbert@halwitz.org> wrote: > Is it that you don't just want to raise your own exceptions manually, e.g.: > > try: > cursor.execute("...") > except dbconn.InternalError, ex: > if ... : > raise OutOfStockException(...) Yeah, this is what I'm doing now. But there's a good chance that something is going to get mapped to the OutOfStockException when it is really a completely different kind of exception, like maybe I forgot to set a non-null column. So, really, I want to be able raise specific exceptions within postgresql, and then define how those are converted to python objects. Maybe I need to verify that postgresql supports custom exceptions. Matt -- W. Matthew Wilson matt@tplus1.com http://tplus1.com
В списке psycopg по дате отправления: