Test for exceptions of the correct type.