1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

instrument/daq: Provide available devices in error message

Display available daq devices in error message if requested device is
unavailable.
This commit is contained in:
Marc Bonnici 2018-09-20 15:18:22 +01:00 committed by setrofim
parent f2a88fd1dc
commit 150fe2b32b

View File

@ -60,7 +60,8 @@ class DaqInstrument(Instrument):
result = self.execute('list_devices')
if result.status == Status.OK:
if device_id not in result.data:
raise ValueError('Device "{}" is not found on the DAQ server.'.format(device_id))
msg = 'Device "{}" is not found on the DAQ server. Available devices are: "{}"'
raise ValueError(msg.format(device_id, ', '.join(result.data)))
elif result.status != Status.OKISH:
raise HostError('Problem querying DAQ server: {}'.format(result.message))