(fn)
return _wrapped
Decorator to raise any errors which have appeared on the bus' error_queue during execution

    There are two situations in which we can categorise errors:

        1. Errors which occur from a user directly accessing the bus.
           For example, calling an RPC or firing an event
        2. Errors which occur within background tasks which are running as
           part of the Lightbus worker

    This decorator handles the former. The BusClient's error_monitor() handles the second
Decorator to raise any errors which have appeared on the bus' error_queue during execution
Decorator to raise any errors which have appeared on the bus error_queue during execution
def raise_queued_errors(fn):
    """Decorator to raise any errors which have appeared on the bus' error_queue during execution

    There are two situations in which we can categorise errors:

        1. Errors which occur from a user directly accessing the bus.
           For example, calling an RPC or firing an event
        2. Errors which occur within background tasks which are running as
           part of the Lightbus worker

    This decorator handles the former. The BusClient's error_monitor() handles the second
    """
    if not iscoroutinefunction(fn):
        raise AsyncFunctionOrMethodRequired(
            "@raise_queued_errors can only be used on async methods"
        )

    @wraps(fn)
    async def _wrapped(self: "BusClient", *args, **kwargs):
        result = await fn(self, *args, **kwargs)
        await self.raise_errors()
        return result

    return _wrapped
def raise_queued_errors ( fn ) : if not iscoroutinefunction ( fn ) : raise AsyncFunctionOrMethodRequired ( "@raise_queued_errors can only be used on async methods" ) @ wraps ( fn ) async def _wrapped ( self : "BusClient" , * args , * * kwargs ) : result = await fn ( self , * args , * * kwargs ) await self . raise_errors ( ) return result return _wrapped