No more bare excepts
This commit is contained in:
@@ -330,7 +330,7 @@ class Cluster(object):
|
||||
try:
|
||||
self.control_connection.connect()
|
||||
log.debug("Control connection created")
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Control connection failed to connect, "
|
||||
"shutting down Cluster:")
|
||||
self.shutdown()
|
||||
@@ -478,7 +478,7 @@ class Cluster(object):
|
||||
connection = self.connection_factory(host.address)
|
||||
try:
|
||||
self.control_connection.wait_for_schema_agreement(connection)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
statements = self._prepared_statements.values()
|
||||
@@ -497,11 +497,11 @@ class Cluster(object):
|
||||
response.kind != ResultMessage.KIND_PREPARED):
|
||||
log.debug("Got unexpected response when preparing "
|
||||
"statement on host %s: %r" % (host, response))
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Error trying to prepare statement on "
|
||||
"host %s" % (host,))
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
# log and ignore
|
||||
log.exception("Error trying to prepare all statements on host %s" % (host,))
|
||||
|
||||
@@ -596,7 +596,7 @@ class Session(object):
|
||||
if trace:
|
||||
try:
|
||||
query.trace = future.get_query_trace()
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Unable to fetch query trace:")
|
||||
|
||||
return result
|
||||
@@ -634,7 +634,7 @@ class Session(object):
|
||||
|
||||
>>> try:
|
||||
... results = future.result()
|
||||
... except:
|
||||
... except Exception:
|
||||
... log.exception("Operation failed:")
|
||||
|
||||
"""
|
||||
@@ -677,7 +677,7 @@ class Session(object):
|
||||
try:
|
||||
future.send_request()
|
||||
query_id, column_metadata = future.result()
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Error preparing query:")
|
||||
raise
|
||||
|
||||
@@ -687,7 +687,7 @@ class Session(object):
|
||||
host = future._current_host
|
||||
try:
|
||||
self.cluster.prepare_on_all_sessions(query_id, prepared_statement, host)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Error preparing query on all hosts:")
|
||||
|
||||
return prepared_statement
|
||||
@@ -706,7 +706,7 @@ class Session(object):
|
||||
# statement is used. Just log errors and continue on.
|
||||
try:
|
||||
request_id = future._query(host)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Error preparing query for host %s:" % (host,))
|
||||
continue
|
||||
|
||||
@@ -717,7 +717,7 @@ class Session(object):
|
||||
|
||||
try:
|
||||
future.result()
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Error preparing query for host %s:" % (host,))
|
||||
|
||||
def shutdown(self):
|
||||
@@ -942,7 +942,7 @@ class ControlConnection(object):
|
||||
|
||||
self._refresh_node_list_and_token_map(connection)
|
||||
self._refresh_schema(connection)
|
||||
except:
|
||||
except Exception:
|
||||
connection.close()
|
||||
raise
|
||||
|
||||
@@ -1285,7 +1285,7 @@ class _Scheduler(object):
|
||||
def refresh_schema_and_set_result(keyspace, table, control_conn, response_future):
|
||||
try:
|
||||
control_conn.refresh_schema(keyspace, table)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Exception refreshing schema in response to schema change:")
|
||||
finally:
|
||||
response_future._set_final_result(None)
|
||||
@@ -1564,7 +1564,7 @@ class ResponseFuture(object):
|
||||
... rows = future.result()
|
||||
... for row in rows:
|
||||
... ... # process results
|
||||
... except:
|
||||
... except Exception:
|
||||
... log.exception("Operation failed:")
|
||||
|
||||
"""
|
||||
|
@@ -175,7 +175,7 @@ class Connection(object):
|
||||
self.handle_pushed(response)
|
||||
elif callback is not None:
|
||||
callback(response)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Callback handler errored, ignoring:")
|
||||
|
||||
@defunct_on_error
|
||||
|
@@ -201,7 +201,7 @@ class AsyncoreConnection(Connection, asyncore.dispatcher):
|
||||
for cb in self._push_watchers.get(response.event_type, []):
|
||||
try:
|
||||
cb(response.event_args)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Pushed event handler errored, ignoring:")
|
||||
|
||||
def push(self, data):
|
||||
|
@@ -216,7 +216,7 @@ class LibevConnection(Connection):
|
||||
for cb in self._push_watchers.get(response.event_type, []):
|
||||
try:
|
||||
cb(response.event_args)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Pushed event handler errored, ignoring:")
|
||||
|
||||
def push(self, data):
|
||||
|
@@ -359,7 +359,7 @@ class HostConnectionPool(object):
|
||||
def _create_new_connection(self):
|
||||
try:
|
||||
self._add_conn_if_under_max()
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Unexpectedly failed to create new connection")
|
||||
finally:
|
||||
with self._lock:
|
||||
|
@@ -63,7 +63,7 @@ def main():
|
||||
|
||||
try:
|
||||
rows = future.result()
|
||||
except:
|
||||
except Exception:
|
||||
log.exeception()
|
||||
|
||||
for row in rows:
|
||||
|
@@ -28,7 +28,7 @@ def setup_package():
|
||||
cluster = CCMCluster.load(path, CLUSTER_NAME)
|
||||
log.debug("Found existing ccm test cluster, clearing")
|
||||
cluster.clear()
|
||||
except:
|
||||
except Exception:
|
||||
log.debug("Creating new ccm test cluster")
|
||||
cluster = CCMCluster(path, CLUSTER_NAME, cassandra_version='1.2.6')
|
||||
cluster.set_configuration_options({'start_native_transport': True})
|
||||
@@ -37,7 +37,7 @@ def setup_package():
|
||||
|
||||
log.debug("Starting ccm test cluster")
|
||||
cluster.start(wait_for_binary_proto=True)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Failed to start ccm cluster:")
|
||||
raise
|
||||
|
||||
|
Reference in New Issue
Block a user