Hello.
I'd like to differentiate between:
- FATAL: no pg_hba.conf entry for host blah-blah
- could not connect to server: Connection Refused
- timeout expired
It seems that the only way to do so is to parse the string
OperationalError returns, something like this:
try:
conn = psycopg2.connect(conn_string)
except psycopg2.OperationalError as err:
if str(err).startswith('FATAL: no pg_hba'):
# do stuff
...
Is there a better (more proper) way do figure out what went wrong when
OperationalException is thrown?
Mario