Summary
Starting the server with an empty (or comments-only) config file fails with an opaque TypeError instead of a message telling the user the file is empty.
Repro
touch serverConfig.yml
instrumentserver -c serverConfig.yml
Actual
File "src/instrumentserver/config.py", line 50, in loadConfig
if "instruments" not in rawConfig:
TypeError: argument of type 'NoneType' is not iterable
ruamel.yaml's yaml.load() returns None for an empty file, and loadConfig then evaluates "instruments" not in None.
Expected
A clear error, in the spirit of the existing missing-instruments-key message just below it, e.g. "The config file '…' is empty. It needs at least an 'instruments:' section."
Suggested fix
Guard for rawConfig is None right after the yaml.load() call in config.py and raise a descriptive error. (Related to #109, making general exceptions specific.)
Found while writing the Getting Started / quickstart docs.
Summary
Starting the server with an empty (or comments-only) config file fails with an opaque
TypeErrorinstead of a message telling the user the file is empty.Repro
Actual
ruamel.yaml'syaml.load()returnsNonefor an empty file, andloadConfigthen evaluates"instruments" not in None.Expected
A clear error, in the spirit of the existing missing-
instruments-key message just below it, e.g. "The config file '…' is empty. It needs at least an 'instruments:' section."Suggested fix
Guard for
rawConfig is Noneright after theyaml.load()call inconfig.pyand raise a descriptive error. (Related to #109, making general exceptions specific.)Found while writing the Getting Started / quickstart docs.