langsci / pypi

Packages for the Python Package index
2 stars 1 forks source link

Test for wrong errors in exception handlings in zenodo classes #17

Closed kopeckyf closed 3 years ago

kopeckyf commented 3 years ago

The class Chapter in zenodo.py is checking for AttributeError, but it may also receive NameError. This happens in other classes and in other exception handlings as well. For example: https://github.com/langsci/pypi/blob/67183e1d7b067ee81e092bc05f62fe6559168d28/langsci/langsci/zenodo.py#L153

What I did to start the script was to use

except (NameError, AttributeError):

instead.

Glottotopia commented 3 years ago

the error handling is there for a purpose. The AttributeError catches None groups, which is intended and handled (in this case by ignoring it). The NameError will have a different source, and should be handled differently. It should not be ignored, but a meaningful message should be printed.

kopeckyf commented 3 years ago

I believe the NameError was thrown in some None-context. Maybe because of a missing affiliation due to the use of langsci-affiliations? Can't replicate now because DOIs are assigned, but I will look very carefully next time and report back.