mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-28 20:03:43 +03:00
Fixed doc example about Error attributes
Catch the Error, not everything! Also, whitespaces.
This commit is contained in:
parent
cafae16072
commit
3775a9d95d
|
@ -150,7 +150,7 @@ available through the following exceptions:
|
|||
|
||||
>>> try:
|
||||
... cur.execute("SELECT * FROM barf")
|
||||
... except Exception, e:
|
||||
... except psycopg2.Error as e:
|
||||
... pass
|
||||
|
||||
>>> e.pgcode
|
||||
|
@ -159,6 +159,7 @@ available through the following exceptions:
|
|||
ERROR: relation "barf" does not exist
|
||||
LINE 1: SELECT * FROM barf
|
||||
^
|
||||
|
||||
.. attribute:: cursor
|
||||
|
||||
The cursor the exception was raised from; `None` if not applicable.
|
||||
|
@ -170,7 +171,7 @@ available through the following exceptions:
|
|||
|
||||
>>> try:
|
||||
... cur.execute("SELECT * FROM barf")
|
||||
... except Exception, e:
|
||||
... except psycopg2.Error, e:
|
||||
... pass
|
||||
|
||||
>>> e.diag.severity
|
||||
|
|
Loading…
Reference in New Issue
Block a user