Skip to content

Commit cc7d098

Browse files
committed
Document MessageRejectedError
1 parent 3c775aa commit cc7d098

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

docs/references/exceptions.rst

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ Exceptions
1212
.. autoclass:: twitchio.InvalidTokenException
1313
:members:
1414

15+
.. autoclass:: twitchio.MessageRejectedError
16+
:members:
17+
1518

1619
Exception Hierarchy
1720
~~~~~~~~~~~~~~~~~~~
1821

1922
.. exception_hierarchy::
2023

2124
- :exc:`TwitchioException`
22-
- :exc:`HTTPException`
23-
- :exc:`InvalidTokenException`
25+
- :exc:`HTTPException`
26+
- :exc:`InvalidTokenException`
27+
- :exc:`MessageRejectedError`

twitchio/exceptions.py

+15
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,21 @@ class EventsubVerifyException(TwitchioException): ...
133133

134134

135135
class MessageRejectedError(TwitchioException):
136+
"""Exception raised when Twitch rejects a sent message. This is not the same as a :exc:`HTTPException` which is raised
137+
when the request fails for a reason.
138+
139+
Attributes
140+
----------
141+
channel: :class:`~twitchio.PartialUser`
142+
The the channel the message was attempted to be sent to.
143+
code: str | None
144+
The drop code Twitch responded with.
145+
message: str | None
146+
The message Twitch responded with, with the reason why the message was rejected.
147+
content: str
148+
The content of the original message sent.
149+
"""
150+
136151
def __init__(self, msg: str, *, message: SentMessage, channel: PartialUser, content: str) -> None:
137152
self.channel: PartialUser = channel
138153
self.code: str | None = message.dropped_code

0 commit comments

Comments
 (0)