Test errors based on exception message.