eregs / regulations-parser

Parser for U.S. federal regulations and other regulatory information
Creative Commons Zero v1.0 Universal
36 stars 40 forks source link

#369: adding try/except to amendments getter #378

Closed gregoryfoster closed 7 years ago

gregoryfoster commented 7 years ago

Per @cmc333333's guidance, adding a try/except block around the amendments getter for the NoticeXML class. This enables bypassing of parsing errors in other CFR parts.

cmc333333 commented 7 years ago

Thanks @gregoryfoster! Looks like there are a few linter errors from Travis; would you mind addressing? Alternatively, there's a checkbox in the Github interface that allows maintainers to update your fork's branch, which would work.

Regarding the bare exception: do you know if there's a more specific exception being thrown? If not, we can just add # noqa to the line.

gregoryfoster commented 7 years ago

Hi @cmc333333. I shrank the error message to address the line length warning and added # noqa to the bare except: line. At this time, I'm not sure what exceptions to expect, and feel like a catch-all is a good idea in this location. If there's a better exception handling pattern to follow, I'm opening up the branch for your commits and eager to learn!

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.04%) to 91.904% when pulling 9e91d00aac02e6da2cfaea785b6633161862f33c on gregoryfoster:369-try-catch-amendments into b2a4c0761d8a76b0eb10f7425a467ad4becc8865 on eregs:master.

cmc333333 commented 7 years ago

Thanks @gregoryfoster! Unfortunately, we don't have a great exception-handling strategy at the moment (this is why you see so many non-helpful errors). I think, ideally, we'd have a grasp on what operations have a good chance of failing and account for those with human friendly error messages, but that's further off.