postgresql - How to catch specific Postgres exceptions in Python psycopg2 -


default psycopg2 error messages broad. of time throws:

psycopg2.operationalerror

without additional information. hard guess, real reason of error - either incorrect user credentials, or fact server not running. so, need more appropriate error handling, error codes in pymysql library.

i've seen this page, not help. when do

except exception err:     print(err.pgcode) 

it prints none. , errorcodes undefined. tried import it, failed. so, need help.


Comments

Popular posts from this blog

ios - Is 'init' forbidden as *part* of a variable name? -

javascript - Why Selenium can't find an element that is graphically visible -

angular - Angular2 Router: Cannot find primary outlet to load 'HomeComponent' -