From ed48667738335c0f54f0e522c684231f2b740403 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 25 Oct 2017 13:16:08 -0300 Subject: [style] E722 do not use bare except --- src/leap/soledad/client/_db/adbapi.py | 4 ++-- src/leap/soledad/client/incoming.py | 6 +++--- src/leap/soledad/common/l2db/remote/http_app.py | 2 +- src/leap/soledad/server/_blobs.py | 2 +- src/leap/soledad/server/session.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/leap/soledad') diff --git a/src/leap/soledad/client/_db/adbapi.py b/src/leap/soledad/client/_db/adbapi.py index 5c28d108..7deb0feb 100644 --- a/src/leap/soledad/client/_db/adbapi.py +++ b/src/leap/soledad/client/_db/adbapi.py @@ -275,11 +275,11 @@ class U1DBConnectionPool(adbapi.ConnectionPool): trans.close() conn.commit() return result - except: + except Exception: excType, excValue, excTraceback = sys.exc_info() try: conn.rollback() - except: + except Exception: logger.error(None, "Rollback failed") compat.reraise(excValue, excTraceback) diff --git a/src/leap/soledad/client/incoming.py b/src/leap/soledad/client/incoming.py index aa7065e8..0766040f 100644 --- a/src/leap/soledad/client/incoming.py +++ b/src/leap/soledad/client/incoming.py @@ -85,7 +85,7 @@ class IncomingBoxProcessingLoop: for consumer in self.consumers: try: parts = yield consumer.process(item, item_id=item_id) - except: + except Exception: msg = "Consumer %s failed to process item %s: %s" msg %= (consumer.name, item_id, sys.exc_info()[0]) log.error(msg) @@ -94,7 +94,7 @@ class IncomingBoxProcessingLoop: yield self.incoming_box.set_processed(item_id) try: yield consumer.save(parts, item_id=item_id) - except: + except Exception: msg = "Consumer %s failed to save item %s: %s" msg %= (consumer.name, item_id, sys.exc_info()[0]) log.error(msg) @@ -133,7 +133,7 @@ class IncomingBox: try: yield self.blob_manager.set_flags(blob_id, [Flags.PROCESSING], namespace=self.namespace) - except: + except Exception: defer.returnValue(None) blob = yield self.blob_manager.get(blob_id, namespace=self.namespace) defer.returnValue(blob) diff --git a/src/leap/soledad/common/l2db/remote/http_app.py b/src/leap/soledad/common/l2db/remote/http_app.py index 2ec8ac1f..e719d9a4 100644 --- a/src/leap/soledad/common/l2db/remote/http_app.py +++ b/src/leap/soledad/common/l2db/remote/http_app.py @@ -623,7 +623,7 @@ class HTTPApp(object): responder.send_response_json(400, error="bad request") except KeyboardInterrupt: raise - except: + except Exception: self.request_failed(environ) raise else: diff --git a/src/leap/soledad/server/_blobs.py b/src/leap/soledad/server/_blobs.py index 22277fc4..55ef0d86 100644 --- a/src/leap/soledad/server/_blobs.py +++ b/src/leap/soledad/server/_blobs.py @@ -136,7 +136,7 @@ class FilesystemBlobsBackend(object): os.unlink(blob_path) try: os.unlink(blob_path + '.flags') - except: + except Exception: pass def get_blob_size(user, blob_id, namespace=''): diff --git a/src/leap/soledad/server/session.py b/src/leap/soledad/server/session.py index 8f0e4639..786ea031 100644 --- a/src/leap/soledad/server/session.py +++ b/src/leap/soledad/server/session.py @@ -117,7 +117,7 @@ class SoledadSession(HTTPAuthSessionWrapper): credentials = self._credentialFactory.decode(auth_data, request) except error.LoginFailed: return UnauthorizedResource() - except: + except Exception: # If you port this to the newer log facility, be aware that # the tests rely on the error to be logged. log.err(None, "Unexpected failure from credentials factory") -- cgit v1.2.3