inveniosoftware-contrib / invenio-classifier

Invenio module for record classification.
GNU General Public License v2.0
6 stars 12 forks source link

keyworder: prevent "unprintable KeyError" problem #38

Closed jacquerie closed 6 years ago

jacquerie commented 6 years ago

Sentry: https://sentry.inspirehep.net/inspire-sentry/prod/issues/6/

For certain combinations of input files and taxonomies it happens that the ckw_out dictionary does not contain all composite keywords in the candidates list. This would normally raise a KeyError using a string representation of the keyword, but it turns out that that fails with an AttributeError since none of the composite keywords contain a short_id attribute, shadowing the original error.

This commit prevents the KeyError from happening, but does not fix the underlying fact that composite keyword are impossible to print.

puntonim commented 6 years ago

Looks good