diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2012-01-19 01:30:46 +0000 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2012-01-19 01:30:46 +0000 |
| commit | 78895e6943978d3922639f8162e148b8c60ad143 (patch) | |
| tree | 324ce9308f886e1930595a374f03d8e536014d4b /doc/src | |
| parent | db987250c8cb8049fd5e4c55f23c1c1b9b0fdc44 (diff) | |
| download | psycopg2-78895e6943978d3922639f8162e148b8c60ad143.tar.gz | |
Added doc for Error.cursor
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/module.rst | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/doc/src/module.rst b/doc/src/module.rst index 29f4b63..5a2496c 100644 --- a/doc/src/module.rst +++ b/doc/src/module.rst @@ -117,31 +117,30 @@ available through the following exceptions: if not available. The `~psycopg2.errorcodes` module contains symbolic constants representing PostgreSQL error codes. - .. extension:: + .. doctest:: + :options: +NORMALIZE_WHITESPACE - The `~Error.pgerror` and `~Error.pgcode` attributes are - Psycopg extensions. + >>> try: + ... cur.execute("SELECT * FROM barf") + ... except Exception, e: + ... pass - .. doctest:: - :options: +NORMALIZE_WHITESPACE + >>> e.pgcode + '42P01' + >>> print e.pgerror + ERROR: relation "barf" does not exist + LINE 1: SELECT * FROM barf + ^ + .. attribute:: cursor - >>> try: - ... cur.execute("SELECT * FROM barf") - ... except Exception, e: - ... pass + The cursor the exception was raised from; `None` if not applicable. - >>> e.pgcode - '42P01' - >>> print e.pgerror - ERROR: relation "barf" does not exist - LINE 1: SELECT * FROM barf - ^ + .. extension:: - .. versionchanged:: 2.0.7 added `Error.pgerror` and - `Error.pgcode` attributes. + The `~Error.pgerror`, `~Error.pgcode`, and `~Error.cursor` attributes + are Psycopg extensions. - .. exception:: InterfaceError Exception raised for errors that are related to the database interface |
