Beispiel #1
0
    def emit_exceptions(self, propagate=True, always_log=False, emit=True):
        """
        Returns a context manager that will log exceptions that are not handled
        when the ``error`` event is emitted.

        :param propagate: Propagate all exceptions (i.e. re-raise).
        :param always_log: Whether to log the exception even if handled.
        :param emit: Whether to emit the `error` event if an exception is
            trapped.
        """
        return events.emit_exceptions(
            self,
            self.logger,
            propagate=propagate,
            always_log=always_log,
            emit=emit,
            skip_types=(gevent.GreenletExit,),
        )
Beispiel #2
0
 def emit_exceptions(self, emitter=None, logger=None, **kwargs):
     return events.emit_exceptions(
         emitter or mock.Mock(),
         logger or mock.Mock(),
         **kwargs
     )