Re: Feature branches merged to master for 2.8 release - Mailing list psycopg

From Karsten Hilbert
Subject Re: Feature branches merged to master for 2.8 release
Date
Msg-id 20181015121154.GC2008@hermes.hilbert.loc
Whole thread Raw
In response to Feature branches merged to master for 2.8 release  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Responses Re: Feature branches merged to master for 2.8 release  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
List psycopg
On Mon, Oct 15, 2018 at 12:48:04PM +0100, Daniele Varrazzo wrote:

> - the new 'errors' module. About it I have a doubt: we convert
> postgres error messages [2] from lower_case to CamelCase because the
> latter is the convention for Python class, but maybe leaving as they
> are makes more sense? Easier to google for them or grep for them in
> the postgres sources maybe?

Since there is no Right or Wrong here, the "best" option
might be to offer both:

Raise whatever is Right for Python (that is, CamelCase)

    raise PostgresSpecificError

but support catching lower case, too:

    class postgres_specific_error(PostgresSpecificError):
        pass

    try:
        something()
    except postgres_specific_error:
        print('lower case')

For the lower case one I would exactly copy what's used by
PostgreSQL itself.

Make sense ?

Karsten
-- 
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B


psycopg by date:

Previous
From: Daniele Varrazzo
Date:
Subject: Re: Feature branches merged to master for 2.8 release
Next
From: Federico Di Gregorio
Date:
Subject: Re: Feature branches merged to master for 2.8 release