diff --git a/spacy/errors.py b/spacy/errors.py index 862cc71d8..a10e5d9bd 100644 --- a/spacy/errors.py +++ b/spacy/errors.py @@ -483,6 +483,7 @@ class Errors: E199 = ("Unable to merge 0-length span at doc[{start}:{end}].") # TODO: fix numbering after merging develop into master + E952 = ("The section '{name}' is not a valid section in the provided config.") E953 = ("Mismatched IDs received by the Tok2Vec listener: {id1} vs. {id2}") E954 = ("The Tok2Vec listener did not receive a valid input.") E955 = ("Can't find table '{table}' for language '{lang}' in spacy-lookups-data.") diff --git a/spacy/util.py b/spacy/util.py index eba60795a..d1951145f 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -1121,9 +1121,8 @@ def dot_to_object(config: Config, section: str): for item in parts: try: component = component[item] - except (KeyError, TypeError) as e: - msg = f"The section '{section}' is not a valid section in the provided config." - raise KeyError(msg) + except (KeyError, TypeError): + raise KeyError(Errors.E952.format(name=section)) return component