Fix some tests of exceptions to check for the actual error message we care about

The test was checking for one word that appeared in the trace rather than the
specific error message we expect to be thrown.