smell: removes global catches, even if it may help in such critical places.

This commit is contained in:
Romain Dorgueil
2018-08-11 07:06:12 +02:00
parent 23e93c6970
commit 7ae1fa82f7
4 changed files with 6 additions and 6 deletions

View File

@ -67,7 +67,7 @@ class ConfigurableMeta(type):
try: try:
import _functools import _functools
except: except Exception:
import functools import functools
PartiallyConfigured = functools.partial PartiallyConfigured = functools.partial

View File

@ -133,7 +133,7 @@ class ContextCurrifier:
try: try:
# todo yield from ? how to ? # todo yield from ? how to ?
processor.send(self._stack_values.pop()) processor.send(self._stack_values.pop())
except StopIteration as exc: except StopIteration:
# This is normal, and wanted. # This is normal, and wanted.
pass pass
else: else:

View File

@ -160,7 +160,7 @@ class NodeExecutionContext(BaseContext, WithStatistics):
if self._stack: if self._stack:
try: try:
self._stack.teardown() self._stack.teardown()
except: except Exception:
self.fatal(sys.exc_info()) self.fatal(sys.exc_info())
super().stop() super().stop()

View File

@ -29,7 +29,7 @@ class ExecutorStrategy(Strategy):
with self.create_executor(graph) as executor: with self.create_executor(graph) as executor:
try: try:
context.start(self.get_starter(executor, futures)) context.start(self.get_starter(executor, futures))
except: except Exception:
logger.critical('Exception caught while starting execution context.', exc_info=sys.exc_info()) logger.critical('Exception caught while starting execution context.', exc_info=sys.exc_info())
while context.alive: while context.alive:
@ -53,14 +53,14 @@ class ExecutorStrategy(Strategy):
try: try:
with node: with node:
node.loop() node.loop()
except: except Exception:
logging.getLogger(__name__).critical( logging.getLogger(__name__).critical(
'Critical error in threadpool node starter.', exc_info=sys.exc_info() 'Critical error in threadpool node starter.', exc_info=sys.exc_info()
) )
try: try:
futures.append(executor.submit(_runner)) futures.append(executor.submit(_runner))
except: except Exception:
logging.getLogger(__name__).critical('futures.append', exc_info=sys.exc_info()) logging.getLogger(__name__).critical('futures.append', exc_info=sys.exc_info())
return starter return starter