Added a query exception test.