Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/anyio/_core/_exceptions.py: 81%
16 statements
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-25 06:38 +0000
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-25 06:38 +0000
1from __future__ import annotations
4class BrokenResourceError(Exception):
5 """
6 Raised when trying to use a resource that has been rendered unusable due to external
7 causes (e.g. a send stream whose peer has disconnected).
8 """
11class BrokenWorkerProcess(Exception):
12 """
13 Raised by :func:`run_sync_in_process` if the worker process terminates abruptly or
14 otherwise misbehaves.
15 """
18class BusyResourceError(Exception):
19 """
20 Raised when two tasks are trying to read from or write to the same resource
21 concurrently.
22 """
24 def __init__(self, action: str):
25 super().__init__(f"Another task is already {action} this resource")
28class ClosedResourceError(Exception):
29 """Raised when trying to use a resource that has been closed."""
32class DelimiterNotFound(Exception):
33 """
34 Raised during
35 :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_until` if the
36 maximum number of bytes has been read without the delimiter being found.
37 """
39 def __init__(self, max_bytes: int) -> None:
40 super().__init__(
41 f"The delimiter was not found among the first {max_bytes} bytes"
42 )
45class EndOfStream(Exception):
46 """
47 Raised when trying to read from a stream that has been closed from the other end.
48 """
51class IncompleteRead(Exception):
52 """
53 Raised during
54 :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_exactly` or
55 :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_until` if the
56 connection is closed before the requested amount of bytes has been read.
57 """
59 def __init__(self) -> None:
60 super().__init__(
61 "The stream was closed before the read operation could be completed"
62 )
65class TypedAttributeLookupError(LookupError):
66 """
67 Raised by :meth:`~anyio.TypedAttributeProvider.extra` when the given typed attribute
68 is not found and no default value has been given.
69 """
72class WouldBlock(Exception):
73 """Raised by ``X_nowait`` functions if ``X()`` would block."""