From: Daniele Varrazzo Date: Wed, 14 Jul 2021 00:09:51 +0000 (+0200) Subject: Fix reference target to the psycopg module X-Git-Tag: 3.0.dev1~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ff5ee8d7655b91253dc9c733641fa9896df83f86;p=thirdparty%2Fpsycopg.git Fix reference target to the psycopg module It was stolen by the errors module. --- diff --git a/docs/api/errors.rst b/docs/api/errors.rst index 4993357bd..6994f733e 100644 --- a/docs/api/errors.rst +++ b/docs/api/errors.rst @@ -1,58 +1,13 @@ `errors` -- Package exceptions ============================== +.. module:: psycopg.errors + .. index:: single: Error; Class -.. module:: psycopg - This module exposes objects to represent and examine database errors. -.. autoexception:: Error() - - .. autoattribute:: diag - - -.. module:: psycopg.errors - -.. autoclass:: Diagnostic() - - The object is returned by the `Error.diag` attribute and is passed to the - callback functions registered with - `~psycopg.Connection.add_notice_handler()`. - - All the information available from the :pq:`PQresultErrorField()` function - are exposed as attributes by the object. For instance the `!severity` - attribute returns the `!PG_DIAG_SEVERITY` code. Please refer to the - PostgreSQL documentation for the meaning of all the attributes. - - The attributes available are: - - .. attribute:: - column_name - constraint_name - context - datatype_name - internal_position - internal_query - message_detail - message_hint - message_primary - schema_name - severity - severity_nonlocalized - source_file - source_function - source_line - sqlstate - statement_position - table_name - - A string with the error field if available; `!None` if not available. - The attribute value is available only for errors sent by the server: - not all the fields are available for all the errors and for all the - server versions. - .. currentmodule:: psycopg @@ -84,6 +39,10 @@ derive from the following classes: These classes are exposed both by the Psycopg and the `!psycopg.errors` module. +.. autoexception:: Error() + + .. autoattribute:: diag + .. autoexception:: Warning() .. autoexception:: InterfaceError() .. autoexception:: DatabaseError() @@ -102,6 +61,49 @@ module. .. _sqlstate-exceptions: + +Error diagnostics +----------------- + +.. autoclass:: Diagnostic() + + The object is returned by the `Error.diag` attribute and is passed to the + callback functions registered with + `~psycopg.Connection.add_notice_handler()`. + + All the information available from the :pq:`PQresultErrorField()` function + are exposed as attributes by the object. For instance the `!severity` + attribute returns the `!PG_DIAG_SEVERITY` code. Please refer to the + PostgreSQL documentation for the meaning of all the attributes. + + The attributes available are: + + .. attribute:: + column_name + constraint_name + context + datatype_name + internal_position + internal_query + message_detail + message_hint + message_primary + schema_name + severity + severity_nonlocalized + source_file + source_function + source_line + sqlstate + statement_position + table_name + + A string with the error field if available; `!None` if not available. + The attribute value is available only for errors sent by the server: + not all the fields are available for all the errors and for all the + server versions. + + SQLSTATE exceptions ------------------- diff --git a/docs/api/module.rst b/docs/api/module.rst index aeb70b3fe..a9c98e31a 100644 --- a/docs/api/module.rst +++ b/docs/api/module.rst @@ -7,8 +7,7 @@ it also exposes the `module-level objects`__ required by the specifications. .. __: https://www.python.org/dev/peps/pep-0249/ .. __: https://www.python.org/dev/peps/pep-0249/#module-interface - -.. currentmodule:: psycopg +.. module:: psycopg .. autofunction:: connect