def _expected_exception(type_): if isinstance(type_, ARRAY): return IntegrityError else: return DataError