logo       

[psycopg] #98: 'raise' is better than 'raise err' when reraising errors.: msg#00000

python.db.psycopg.devel

Subject: [psycopg] #98: 'raise' is better than 'raise err' when reraising errors.

#98: 'raise' is better than 'raise err' when reraising errors.
-------------------------------------------+--------------------------------
Reporter: docwhat+bugs.psycopg@xxxxxxxx | Owner: fog
Type: defect | Status: new
Priority: normal | Milestone:
Component: psycopg1 | Version: 1.1.21
Severity: normal | Keywords:
-------------------------------------------+--------------------------------
psycopg-1.1.21
source:/psycopg1/trunk/ZPsycopgDA/db.py (line 246) does a {{{raise err}}}
to re-raise an error instead of just doing {{{raise}}}.

This cuts short the tracebacks and call stack, making it hard to find the
error that caused this exception.

{{{
#!python
try:
...
except StandardError, err: # Using just raise below would let you just use
'except:'
self._abort()
raise # using just raise keeps the call stack intact.
}}}

Ciao!

--
Ticket URL: <http://initd.org/tracker/psycopg/ticket/98>
psycopg <http://initd.org/>
psycopg_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/+sw@xxxxxxxxxxxxxxxx
http://lists.initd.org/mailman/listinfo/psycopg
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise