Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

Liste des GroupesRevenir à cl python 
Sujet : Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.python
Date : 09. Sep 2024, 04:34:27
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vblqc3$2987j$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Pan/0.160 (Toresk; )
On Mon, 9 Sep 2024 13:48:32 +1200, Greg Ewing wrote:

I would much prefer to have just *one* place where exceptions are caught
and logged.

Why catch exceptions at all? The only kind of database-related exception
I’ve felt the need to catch so far is the occasional IntegrityError from
trying to insert a record with a duplicate key (and that only in certain
situations). Anything else (particularly SQL syntax errors) I would rather
just leave to the default exception-handling mechanism -- why waste time
reinventing its information-reporting abilities?

Date Sujet#  Auteur
8 Sep 24 * Re: psycopg2: proper positioning of .commit() within try: except: blocks5Karsten Hilbert
9 Sep 24 `* Re: psycopg2: proper positioning of .commit() within try: except: blocks4Greg Ewing
9 Sep 24  +- Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
9 Sep 24  +- Re: psycopg2: proper positioning of .commit() within try: except: blocks1Karsten Hilbert
9 Sep 24  `- Re: psycopg2: proper positioning of .commit() within try: except: blocks1Karsten Hilbert

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal