exit on query failure