(coroutine: Coroutine, error_queue: InternalQueue, help: str = "")
return coroutine_()
Await a coroutine and place any errors into the provided queue

    Items added to the queue will be of the `Error` type. This `Error` type
    allows for more informative error messages.

    See Also: Error
Await a coroutine and place any errors into the provided queue
Await a coroutine and place any errors into the provided queue
def queue_exception_checker(coroutine: Coroutine, error_queue: InternalQueue, help: str = ""):
    """Await a coroutine and place any errors into the provided queue

    Items added to the queue will be of the `Error` type. This `Error` type
    allows for more informative error messages.

    See Also: Error
    """
    invoking_stack = extract_stack()[:-1]

    @wraps(coroutine)
    async def coroutine_():
        try:
            await coroutine
        except asyncio.CancelledError:
            # Was cancelled by the caller, so just re-raise the cancelled error and
            # let the coroutine finish as requested
            raise
        except Exception as e:
            # This is an exception which is going to need to be dealt with

            # We set a flag on each exception we add to the queue to indicate
            # that it has been enqueued. This prevents an exception being added to the
            # queue multiple times as it propagates up potentially multiple levels
            # of asyncio tasks (which of which would presumably be wrapped up in queue_exception_checker())
            if not getattr(e, "enqueued", False):
                # Flag not set, so add this error to the queue, and set the flag on it
                e.enqueued = True
                error = Error(*sys.exc_info(), invoking_stack, help)
                await error_queue.put(error)

            raise

    return coroutine_()
def queue_exception_checker ( coroutine : Coroutine , error_queue : InternalQueue , help : str = "" ) : invoking_stack = extract_stack ( ) [ : - 1 ] @ wraps ( coroutine ) async def coroutine_ ( ) : try : await coroutine except asyncio . CancelledError : # Was cancelled by the caller, so just re-raise the cancelled error and # let the coroutine finish as requested raise except Exception as e : # This is an exception which is going to need to be dealt with # We set a flag on each exception we add to the queue to indicate # that it has been enqueued. This prevents an exception being added to the # queue multiple times as it propagates up potentially multiple levels # of asyncio tasks (which of which would presumably be wrapped up in queue_exception_checker()) if not getattr ( e , "enqueued" , False ) : # Flag not set, so add this error to the queue, and set the flag on it e . enqueued = True error = Error ( * sys . exc_info ( ) , invoking_stack , help ) await error_queue . put ( error ) raise return coroutine_ ( )