remove __doctest attribute & use error.name to detect error type.