When I do
conn = PGconn.connect("localhost", 5432, "" , "", db_name, postgres_username, postgres_password)
and the password is incorrect, an exception (PG::ConnectionBad) is thrown (which is what I expect)
begin
conn = PGconn.connect("localhost", 5432, "" , "", db_name, postgres_username, postgres_password)
# Do some stuff
rescue PG::ConnectionBad => e
puts e
raise # reraise exception
rescue Exception => e
puts e
raise # reraise exception
ensure
conn.close if conn
end
when I do a "puts e" I get
FATAL: password authentication failed for user "something@something.com"
FATAL: password authentication failed for user "something@something.com"
That is, the failure message is repeated.
I'm using
PostgreSQL 9.6.3 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
Ubuntu 16.04
Is this a bug? Is it to be expected?