summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-05-09 10:04:13 +0200
committerOle Trøan <otroan@employees.org>2019-05-09 14:18:45 +0000
commit6dd16142c92912cb4570c26b280b21f2114548dc (patch)
tree176fc2e17996e797e1b95d7ef8564c9a25ce613d
parent54bc5e40cb92597f9e18c4085699cf02dfa5d585 (diff)
Improve exceptions in vpp_transport_socket.py
Added TODOs for further improvements. Change-Id: I6724dd8b3de5537518a5c6e0ee9abe72f57b273e Signed-off-by: Vratko Polak <vrpolak@cisco.com>
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_transport_socket.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_transport_socket.py b/src/vpp-api/python/vpp_papi/vpp_transport_socket.py
index b00d15de873..caee43f4713 100644
--- a/src/vpp-api/python/vpp_papi/vpp_transport_socket.py
+++ b/src/vpp-api/python/vpp_papi/vpp_transport_socket.py
@@ -14,6 +14,7 @@ import logging
class VppTransportSocketIOError(IOError):
+ # TODO: Document different values of error number (first numeric argument).
pass
@@ -70,8 +71,8 @@ class VppTransport(object):
def connect(self, name, pfx, msg_handler, rx_qlen):
if self.message_thread is not None:
- raise RuntimeError(
- "PAPI socket transport connect: You need to disconnect first.")
+ raise VppTransportSocketIOError(
+ 1, "PAPI socket transport connect: Need to disconnect first.")
self.message_thread = threading.Thread(target=self.msg_thread_func)
# Create a UDS socket
@@ -98,6 +99,7 @@ class VppTransport(object):
msg = self._read()
hdr, length = self.parent.header.unpack(msg, 0)
if hdr.msgid != 16:
+ # TODO: Add first numeric argument.
raise VppTransportSocketIOError('Invalid reply message')
r, length = sockclnt_create_reply.unpack(msg)