[elbe-devel] [PATCH 22/28] pylint: daemons soap faults: fix Exception order in soap_faults()

Torben Hohn torben.hohn at linutronix.de
Wed Aug 22 11:29:16 CEST 2018


InvalidState is derived from ProjectManagerError.
This must be caught first, or we would never Catch that.

reorder exceptions.

Note that we must do this for all argument count.
I now know, how to implement this more generically.

We could also delay this until all the cases are collapsed to one.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/daemons/soap/faults.py | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/elbepack/daemons/soap/faults.py b/elbepack/daemons/soap/faults.py
index 8e9f966c..c56d1bd0 100644
--- a/elbepack/daemons/soap/faults.py
+++ b/elbepack/daemons/soap/faults.py
@@ -77,10 +77,10 @@ def soap_faults(func):
         def wrapped(self):
             try:
                 return func(self)
-            except ProjectManagerError as e:
-                raise SoapElbeProjectError(str(e))
             except InvalidState as e:
                 raise SoapElbeInvalidState()
+            except ProjectManagerError as e:
+                raise SoapElbeProjectError(str(e))
             except ElbeDBError as e:
                 raise SoapElbeDBError(str(e))
             except OSError as e:
@@ -97,10 +97,10 @@ def soap_faults(func):
         def wrapped(self, arg1):
             try:
                 return func(self, arg1)
-            except ProjectManagerError as e:
-                raise SoapElbeProjectError(str(e))
             except InvalidState as e:
                 raise SoapElbeInvalidState()
+            except ProjectManagerError as e:
+                raise SoapElbeProjectError(str(e))
             except ElbeDBError as e:
                 raise SoapElbeDBError(str(e))
             except OSError as e:
@@ -117,10 +117,10 @@ def soap_faults(func):
         def wrapped(self, arg1, arg2):
             try:
                 return func(self, arg1, arg2)
-            except ProjectManagerError as e:
-                raise SoapElbeProjectError(str(e))
             except InvalidState as e:
                 raise SoapElbeInvalidState()
+            except ProjectManagerError as e:
+                raise SoapElbeProjectError(str(e))
             except ElbeDBError as e:
                 raise SoapElbeDBError(str(e))
             except OSError as e:
@@ -137,10 +137,10 @@ def soap_faults(func):
         def wrapped(self, arg1, arg2, arg3):
             try:
                 return func(self, arg1, arg2, arg3)
-            except ProjectManagerError as e:
-                raise SoapElbeProjectError(str(e))
             except InvalidState as e:
                 raise SoapElbeInvalidState()
+            except ProjectManagerError as e:
+                raise SoapElbeProjectError(str(e))
             except ElbeDBError as e:
                 raise SoapElbeDBError(str(e))
             except OSError as e:
@@ -157,10 +157,10 @@ def soap_faults(func):
         def wrapped(self, arg1, arg2, arg3, arg4):
             try:
                 return func(self, arg1, arg2, arg3, arg4)
-            except ProjectManagerError as e:
-                raise SoapElbeProjectError(str(e))
             except InvalidState as e:
                 raise SoapElbeInvalidState()
+            except ProjectManagerError as e:
+                raise SoapElbeProjectError(str(e))
             except ElbeDBError as e:
                 raise SoapElbeDBError(str(e))
             except OSError as e:
@@ -177,10 +177,10 @@ def soap_faults(func):
         def wrapped(self, arg1, arg2, arg3, arg4, arg5):
             try:
                 return func(self, arg1, arg2, arg3, arg4, arg5)
-            except ProjectManagerError as e:
-                raise SoapElbeProjectError(str(e))
             except InvalidState as e:
                 raise SoapElbeInvalidState()
+            except ProjectManagerError as e:
+                raise SoapElbeProjectError(str(e))
             except ElbeDBError as e:
                 raise SoapElbeDBError(str(e))
             except OSError as e:
@@ -197,10 +197,10 @@ def soap_faults(func):
         def wrapped(self, arg1, arg2, arg3, arg4, arg5, arg6):
             try:
                 return func(self, arg1, arg2, arg3, arg4, arg5, arg6)
-            except ProjectManagerError as e:
-                raise SoapElbeProjectError(str(e))
             except InvalidState as e:
                 raise SoapElbeInvalidState()
+            except ProjectManagerError as e:
+                raise SoapElbeProjectError(str(e))
             except ElbeDBError as e:
                 raise SoapElbeDBError(str(e))
             except OSError as e:
-- 
2.11.0




More information about the elbe-devel mailing list