query now throws an exception if there is an error