Deutsch English Français Italiano |
<vblqc3$2987j$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro <ldo@nz.invalid> Newsgroups: comp.lang.python Subject: Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited) Date: Mon, 9 Sep 2024 03:34:27 -0000 (UTC) Organization: A noiseless patient Spider Lines: 11 Message-ID: <vblqc3$2987j$1@dont-email.me> References: <Ztx1sZMGTnA3eLP1@hermes.hilbert.loc> <7cb50df2-9c76-477f-91c9-e149c7637104@aklaver.com> <ZtytJMhyvtExPxfF@hermes.hilbert.loc> <5ee80b84-f04b-454d-ab39-45572e0751a1@aklaver.com> <Zty7ZCMwKQl4C4Id@hermes.hilbert.loc> <4a1b12fc-24b7-4c7e-b1f2-6ec9c5f341c2@aklaver.com> <ZtzDubguRDWXwV-t@hermes.hilbert.loc> <62133ebd-a4a3-471b-9acc-3a988b4fcbd7@btinternet.com> <Zt2xHedGIh1-dL4g@hermes.hilbert.loc> <mailman.50.1725804833.2917.python-list@python.org> <lk72fhFo32jU1@mid.individual.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 09 Sep 2024 05:34:27 +0200 (CEST) Injection-Info: dont-email.me; posting-host="48619980776be9ad3edbc43d1fdbfd55"; logging-data="2400499"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19M5VfxF005bQQxNDQ+kp/w" User-Agent: Pan/0.160 (Toresk; ) Cancel-Lock: sha1:fGG0MkgE4jO5yWVK3ZxZ6F2cnR8= Bytes: 2028 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?