Raise MissingDataError on malformed LOINC row instead of returning it - #1833
Open
Rdag15 wants to merge 1 commit into
Open
Raise MissingDataError on malformed LOINC row instead of returning it#1833Rdag15 wants to merge 1 commit into
Rdag15 wants to merge 1 commit into
Conversation
…ng it install_terms did `return MissingDataError(...)` when a Loinc.csv data row had fewer than 9 fields, so callers received the exception instance in place of an ExternalDictionary and cached it; a later `code in term_dictionary` check then raised an opaque TypeError far from the cause. The same method already raises this exception for the missing-file case. Raise it here too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LoincTermsFactory.install_termsreturns aMissingDataErrorwhen aLoinc.csvdata row has fewer than 9 fields, instead of raising it:So the caller (
get_term_dictionary) stores the exception instance in place of theExternalDictionaryand caches it; a latercode in term_dictionarycheck then fails with an opaqueTypeError: argument of type 'MissingDataError' is not iterable, far from the actual cause (a malformed dictionary file — e.g. a truncated row or a trailing blank line).Fix:
raiseit instead of returning it — consistent with the missing-file branch a few lines above in the same method, which alreadyraises the same exception. Added a test (the short-row path had no coverage).