print query errors on failure