Don't compare exception messages, check for instance types only. If one exception raises different messages, use 2 exception classes