From cf8e5838474ed1c6f9252ad0caa0f2773c7e0565 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Thu, 19 May 2022 15:54:05 +0800 Subject: [PATCH] comm_mgmt: expect error on config_read --- artiq/coredevice/comm_mgmt.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/artiq/coredevice/comm_mgmt.py b/artiq/coredevice/comm_mgmt.py index 9833d7520..870e2759d 100644 --- a/artiq/coredevice/comm_mgmt.py +++ b/artiq/coredevice/comm_mgmt.py @@ -160,7 +160,12 @@ class CommMgmt: def config_read(self, key): self._write_header(Request.ConfigRead) self._write_string(key) - self._read_expect(Reply.ConfigData) + ty = self._read_header() + if ty == Reply.Error: + raise IOError("Device failed to read config. The key may not exist.") + elif ty != Reply.ConfigData: + raise IOError("Incorrect reply from device: {} (expected {})". + format(ty, Reply.ConfigData)) return self._read_string() def config_write(self, key, value):