Closed kelwerks closed 11 months ago
I think this is a good start, but I would maybe add some stuff to make it more robust to errors. Right now, if someone were to forget to add an 'interface' entry in the config file, the server would just not launch without a clear error message. One way to improve this is to modify the functions to something like this:
def hdwag_startfunction(other, variables, interface=None, more=x, variables=y):
if interface is None: send error message to logger
else: keep going
or for example when you pull from the config dict:
interface = load_device_config('zi_hdawg', kwargs['config'], logger=kwargs['logger'])['interface']
You can add a line like:
config_dict = load_device_config('zi_hdawg', kwargs['config'], logger=kwargs['logger'])
if 'interface' in config_dict: interface = config_dict['interface']
else: send error message to logger.
Finally, it would be good to add a screenshot of a config .json file for the hdawg (with the new interface entry) to this pull request for documentation.
Thanks for reviewing! I added the error handling and the config file screenshot. Let me know it looks good or if any other changes are necessary.
Sample output if config file includes the new interface key:
Sample output if no interface key is found: