Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions trio/_core/_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@ class TrioInternalError(Exception):

"""

__slots__ = ()


class RunFinishedError(RuntimeError):
"""Raised by `trio.from_thread.run` and similar functions if the
corresponding call to :func:`trio.run` has already finished.

"""

__slots__ = ()


class WouldBlock(Exception):
"""Raised by ``X_nowait`` functions if ``X`` would block."""

__slots__ = ()


class Cancelled(BaseException, metaclass=NoPublicConstructor):
"""Raised by blocking calls if the surrounding scope has been cancelled.
Expand Down Expand Up @@ -59,6 +65,8 @@ class Cancelled(BaseException, metaclass=NoPublicConstructor):

"""

__slots__ = ()

def __str__(self) -> str:
return "Cancelled"

Expand All @@ -73,6 +81,8 @@ class BusyResourceError(Exception):

"""

__slots__ = ()


class ClosedResourceError(Exception):
"""Raised when attempting to use a resource after it has been closed.
Expand All @@ -86,6 +96,8 @@ class ClosedResourceError(Exception):

"""

__slots__ = ()


class BrokenResourceError(Exception):
"""Raised when an attempt to use a resource fails due to external
Expand All @@ -102,6 +114,8 @@ class BrokenResourceError(Exception):

"""

__slots__ = ()


class EndOfChannel(Exception):
"""Raised when trying to receive from a :class:`trio.abc.ReceiveChannel`
Expand All @@ -110,3 +124,5 @@ class EndOfChannel(Exception):
This is analogous to an "end-of-file" condition, but for channels.

"""

__slots__ = ()