Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def try_log(self, fut, name, args, kwargs):
try:
fut.result()
except Exception as exc:
if self.log_exceptions:
for e in self.exclude_log_exceptions:
if isinstance(exc, e):
return
logger.exception(textwrap.dedent("""\
An exception from method %r call occurred.
args = %s
kwargs = %s
"""),
name, pprint.pformat(args), pprint.pformat(kwargs)) # noqa
def process_call_result(self, fut, *, name, args, kwargs):
self.discard_pending(fut)
try:
if fut.result() is not None:
logger.warning("PubSub handler %r returned not None", name)
except asyncio.CancelledError:
return
except (NotFoundError, ParametersError) as exc:
logger.exception("Call to %r caused error: %r", name, exc)
except Exception:
self.try_log(fut, name, args, kwargs)
def process_call_result(self, fut, *, name, args, kwargs):
self.discard_pending(fut)
try:
if fut.result() is not None:
logger.warning("Pipeline handler %r returned not None", name)
except (NotFoundError, ParametersError) as exc:
logger.exception("Call to %r caused error: %r", name, exc)
except asyncio.CancelledError:
return
except Exception:
self.try_log(fut, name, args, kwargs)