From 68c377d90d945cd2647b9e2a69682df8146b0bc2 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sun, 3 Apr 2022 00:58:05 +0200 Subject: [PATCH] docs: add ConnectionTimeout documentation --- docs/api/errors.rst | 12 +++++++++++- psycopg/psycopg/errors.py | 9 +++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/api/errors.rst b/docs/api/errors.rst index 3f0a719bb..ca567be26 100644 --- a/docs/api/errors.rst +++ b/docs/api/errors.rst @@ -73,12 +73,22 @@ These classes are exposed both by this module and the root `psycopg` module. .. autoexception:: NotSupportedError() +Other Psycopg errors +^^^^^^^^^^^^^^^^^^^^ + .. currentmodule:: psycopg.errors + +In addition to the standard DB-API errors, Psycopg defines a few more specific +ones. + +.. autoexception:: ConnectionTimeout() + + + .. index:: single: Exceptions; PostgreSQL - Error diagnostics ----------------- diff --git a/psycopg/psycopg/errors.py b/psycopg/psycopg/errors.py index 28c678677..526e78c1d 100644 --- a/psycopg/psycopg/errors.py +++ b/psycopg/psycopg/errors.py @@ -182,7 +182,7 @@ class ProgrammingError(DatabaseError): class NotSupportedError(DatabaseError): """ - A method or database API was used which is not supported by the database, + A method or database API was used which is not supported by the database. """ __module__ = "psycopg" @@ -190,7 +190,12 @@ class NotSupportedError(DatabaseError): class ConnectionTimeout(OperationalError): """ - Exception raised on timeout connection. + Exception raised on timeout of the `~psycopg.Connection.connect()` method. + + The error is raised if the ``connect_timeout`` is specified and a + connection is not obtained in useful time. + + Subclass of `~psycopg.OperationalError`. """ -- 2.47.3