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
Post a Comment