Added error handling to PSQL conn