fix pylint error '(bad-except-order) Bad except clauses order (X is an ancestor class of Y)'
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 11 Oct 2017 11:41:32 +0300
changeset 1866 9d1e68d557bf
parent 1865 0bd5b3099144
child 1867 418777c1fbc7
fix pylint error '(bad-except-order) Bad except clauses order (X is an ancestor class of Y)'
svgui/pyjs/jsonrpc/jsonrpc.py
tests/tools/check_source.sh
--- a/svgui/pyjs/jsonrpc/jsonrpc.py	Wed Oct 11 11:35:19 2017 +0300
+++ b/svgui/pyjs/jsonrpc/jsonrpc.py	Wed Oct 11 11:41:32 2017 +0300
@@ -30,12 +30,12 @@
             try:
                 result = self.methods[method](*params)
                 return self.response(id, result)
+            except Exception:
+                etype, eval, _etb = sys.exc_info()
+                return self.error(id, 100, 'Exception %s: %s' % (etype, eval))
             except BaseException:
                 etype, eval, _etb = sys.exc_info()
                 return self.error(id, 100, '%s: %s' % (etype.__name__, eval))
-            except Exception:
-                etype, eval, _etb = sys.exc_info()
-                return self.error(id, 100, 'Exception %s: %s' % (etype, eval))
         else:
             return self.error(id, 100, 'method "%s" does not exist' % method)
 
--- a/tests/tools/check_source.sh	Wed Oct 11 11:35:19 2017 +0300
+++ b/tests/tools/check_source.sh	Wed Oct 11 11:41:32 2017 +0300
@@ -242,6 +242,7 @@
     enable=$enable,C0123          # (unidiomatic-typecheck) Using type() instead of isinstance() for a typecheck.
     enable=$enable,E0601          # (used-before-assignment) Using variable 'X' before assignment
     enable=$enable,E1120          # (no-value-for-parameter) No value for argument 'X' in function call
+    enable=$enable,E0701          # (bad-except-order) Bad except clauses order (X is an ancestor class of Y)
     # enable=
 
     options=