exit with failure on query failure