(mail_admins=True)
return _outer
Decorator to log uncaught exceptions and prevent them from
    bubbling up the call chain.
Decorator to log uncaught exceptions and prevent them from
    bubbling up the call chain.
Decorator to log uncaught exceptions and prevent them from bubbling up the call chain .
def handle_uncaught_exceptions(mail_admins=True):
    """Decorator to log uncaught exceptions and prevent them from
    bubbling up the call chain.
    """
    def _outer(fn):
        @wraps(fn)
        def _handle_exceptions(*args, **kwargs):
            try:
                return fn(*args, **kwargs)
            except Exception as e:
                msg = "Uncaught exception from {}.{}".format(fn.__module__, fn.__name__)
                if mail_admins:
                    notify_exception(get_request(), msg)
                else:
                    logging.exception(msg)

        return _handle_exceptions
    return _outer
def handle_uncaught_exceptions ( mail_admins = True ) : def _outer ( fn ) : @ wraps ( fn ) def _handle_exceptions ( * args , * * kwargs ) : try : return fn ( * args , * * kwargs ) except Exception as e : msg = "Uncaught exception from {}.{}" . format ( fn . __module__ , fn . __name__ ) if mail_admins : notify_exception ( get_request ( ) , msg ) else : logging . exception ( msg ) return _handle_exceptions return _outer