UPDATED new tests to check expected error codes for failing queries.