Debian Codegraph @

Doc/library/asyncio-exceptions.rst

raw
1 .. currentmodule:: asyncio
2
3
4 .. _asyncio-exceptions:
5
6 ==========
7 Exceptions
8 ==========
9
10 **Source code:** :source:`Lib/asyncio/exceptions.py`
11
12 ----------------------------------------------------
13
14 .. exception:: TimeoutError
15
16 A deprecated alias of :exc:`TimeoutError`,
17 raised when the operation has exceeded the given deadline.
18
19 .. versionchanged:: 3.11
20
21 This class was made an alias of :exc:`TimeoutError`.
22
23
24 .. exception:: CancelledError
25
26 The operation has been cancelled.
27
28 This exception can be caught to perform custom operations
29 when asyncio Tasks are cancelled. In almost all situations the
30 exception must be re-raised.
31
32 .. versionchanged:: 3.8
33
34 :exc:`CancelledError` is now a subclass of :class:`BaseException` rather than :class:`Exception`.
35
36
37 .. exception:: InvalidStateError
38
39 Invalid internal state of :class:`Task` or :class:`Future`.
40
41 Can be raised in situations like setting a result value for a
42 *Future* object that already has a result value set.
43
44
45 .. exception:: SendfileNotAvailableError
46
47 The "sendfile" syscall is not available for the given
48 socket or file type.
49
50 A subclass of :exc:`RuntimeError`.
51
52
53 .. exception:: IncompleteReadError
54
55 The requested read operation did not complete fully.
56
57 Raised by the :ref:`asyncio stream APIs<asyncio-streams>`.
58
59 This exception is a subclass of :exc:`EOFError`.
60
61 .. attribute:: expected
62
63 The total number (:class:`int`) of expected bytes.
64
65 .. attribute:: partial
66
67 A string of :class:`bytes` read before the end of stream was reached.
68
69
70 .. exception:: LimitOverrunError
71
72 Reached the buffer size limit while looking for a separator.
73
74 Raised by the :ref:`asyncio stream APIs <asyncio-streams>`.
75
76 .. attribute:: consumed
77
78 The total number of to be consumed bytes.