异常¶
-
exception
asyncio.TimeoutError¶ 该操作已超过规定的截止日期。
重要
这个异常与内置
TimeoutError异常不同。
-
exception
asyncio.CancelledError¶ 该操作已被取消。
取消asyncio任务时,可以捕获此异常以执行自定义操作。在几乎所有情况下,都必须重新引发异常。
重要
此异常是
Exception的子类,因此可能会被一个过于宽泛的try..except块意外地阻塞:try: await operation except Exception: # The cancellation is broken because the *except* block # suppresses the CancelledError exception. log.log('an error has occurred')
相反,应使用以下模式:
try: await operation except asyncio.CancelledError: raise except Exception: log.log('an error has occurred')
-
exception
asyncio.SendfileNotAvailableError¶ "sendfile" 系统调用不适用于给定的套接字或文件类型。
子类
RuntimeError。
-
exception
asyncio.IncompleteReadError¶ 请求的读取操作未完全完成。
由 asyncio stream APIs 提出
此异常是
EOFError的子类。
-
exception
asyncio.LimitOverrunError¶ 在查找分隔符时达到缓冲区大小限制。
由 asyncio stream APIs 提出
-
consumed¶ 要消耗的字节总数。
-
