|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [qemu-xen staging] python/qmp.py: add QMPProtocolError
commit 84dcdf0887cdaaba7300442482c99e5064865a2d
Author: John Snow <jsnow@xxxxxxxxxx>
AuthorDate: Fri Jul 10 01:22:10 2020 -0400
Commit: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
CommitDate: Tue Jul 14 22:22:22 2020 +0200
python/qmp.py: add QMPProtocolError
In the case that we receive a reply but are unable to understand it,
use this exception name to indicate that case.
Signed-off-by: John Snow <jsnow@xxxxxxxxxx>
Reviewed-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
Reviewed-by: Kevin Wolf <kwolf@xxxxxxxxxx>
Message-Id: <20200710052220.3306-7-jsnow@xxxxxxxxxx>
Signed-off-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
---
python/qemu/qmp.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py
index 1ae36050a4..7935dababb 100644
--- a/python/qemu/qmp.py
+++ b/python/qemu/qmp.py
@@ -62,6 +62,12 @@ class QMPTimeoutError(QMPError):
"""
+class QMPProtocolError(QMPError):
+ """
+ QMP protocol error; unexpected response
+ """
+
+
class QMPResponseError(QMPError):
"""
Represents erroneous QMP monitor reply
@@ -266,6 +272,10 @@ class QEMUMonitorProtocol:
ret = self.cmd(cmd, kwds)
if 'error' in ret:
raise QMPResponseError(ret)
+ if 'return' not in ret:
+ raise QMPProtocolError(
+ "'return' key not found in QMP response '{}'".format(str(ret))
+ )
return cast(QMPReturnValue, ret['return'])
def pull_event(self, wait=False):
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |