[elbe-devel] [PATCH 01/21] elbepack: soapclient: deduplicate error handling

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Aug 6 11:17:59 CEST 2024


All branches have the same contents.
Catch all the different exceptions in the same "excapt" branch.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/soapclient.py | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
index 1bd369a1a48a..dec3fa4a824e 100644
--- a/elbepack/soapclient.py
+++ b/elbepack/soapclient.py
@@ -59,17 +59,9 @@ class ElbeSoapClient:
             current_retries += 1
             try:
                 control = Client(self.wsdl, timeout=timeout)
-            except URLError as e:
+            except (URLError, socket.error, BadStatusLine):
                 if current_retries > retries:
-                    raise e
-                time.sleep(1)
-            except socket.error as e:
-                if current_retries > retries:
-                    raise e
-                time.sleep(1)
-            except BadStatusLine as e:
-                if current_retries > retries:
-                    raise e
+                    raise
                 time.sleep(1)
 
         # Make sure, that client.service still maps

-- 
2.46.0



More information about the elbe-devel mailing list