adds error handling for pgclient