Added error handling to pg-simple query.