Refine error handling approach
authorjoan <joan@abyz.co.uk>
Sun, 4 Feb 2018 10:18:55 +0000 (10:18 +0000)
committerjoan <joan@abyz.co.uk>
Sun, 4 Feb 2018 10:18:55 +0000 (10:18 +0000)
pigpio.py

index e0642f3fc8ee385ad05e42048d5a469c77f0b4c8..ff2f79370b691c0468f3f8396ab5e5e0181da460 100644 (file)
--- a/pigpio.py
+++ b/pigpio.py
@@ -980,12 +980,8 @@ def _pigpio_command(sl, cmd, p1, p2, rl=True):
     p2:= command parameter 2 (if applicable).
    """
    sl.l.acquire()
-   try:
-      sl.s.send(struct.pack('IIII', cmd, p1, p2, 0))
-      dummy, res = struct.unpack('12sI', sl.s.recv(_SOCK_CMD_LEN))
-   except Exception, e:
-      sl.l.release()
-      raise(e)
+   sl.s.send(struct.pack('IIII', cmd, p1, p2, 0))
+   dummy, res = struct.unpack('12sI', sl.s.recv(_SOCK_CMD_LEN))
    if rl: sl.l.release()
    return res
 
@@ -1007,12 +1003,8 @@ def _pigpio_command_ext(sl, cmd, p1, p2, p3, extents, rl=True):
       else:
          ext.extend(x)
    sl.l.acquire()
-   try:
-      sl.s.sendall(ext)
-      dummy, res = struct.unpack('12sI', sl.s.recv(_SOCK_CMD_LEN))
-   except Exception, e:
-      sl.l.release()
-      raise(e)
+   sl.s.sendall(ext)
+   dummy, res = struct.unpack('12sI', sl.s.recv(_SOCK_CMD_LEN))
    if rl: sl.l.release()
    return res