Move error to Errors

This commit is contained in:
Ines Montani 2020-07-28 16:24:14 +02:00
parent 2748249217
commit ba22111ff4
2 changed files with 3 additions and 3 deletions

View File

@ -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.")

View File

@ -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