How about adding a message to the exception saying that no query was supplied?