mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-18 07:12:31 -05:00
Include status code in APIError and handle APIError in the loop (#4995)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
from typing import Any
|
||||
|
||||
|
||||
class StreamsError(Exception):
|
||||
pass
|
||||
|
||||
@@ -7,7 +10,13 @@ class StreamNotFound(StreamsError):
|
||||
|
||||
|
||||
class APIError(StreamsError):
|
||||
pass
|
||||
def __init__(self, status_code: int, raw_data: Any) -> None:
|
||||
self.status_code = status_code
|
||||
self.raw_data = raw_data
|
||||
super().__init__(f"{status_code=} {raw_data=}")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"{self.__class__.__name__}({self!s})"
|
||||
|
||||
|
||||
class InvalidTwitchCredentials(StreamsError):
|
||||
|
||||
Reference in New Issue
Block a user