Browse Source

Redocument GatewayNotFound error

pull/10109/head
dolfies 2 years ago
parent
commit
82a4d05520
  1. 3
      discord/client.py
  2. 7
      discord/http.py
  3. 3
      docs/api.rst

3
discord/client.py

@ -718,6 +718,9 @@ class Client:
Raises
-------
GatewayNotFound
If the gateway to connect to Discord is not found. Usually if this
is thrown then there is a Discord API outage.
ConnectionClosed
The websocket connection has been terminated.
"""

7
discord/http.py

@ -53,7 +53,7 @@ import datetime
import aiohttp
from .enums import RelationshipAction, InviteType
from .errors import HTTPException, RateLimited, Forbidden, NotFound, LoginFailure, DiscordServerError, CaptchaRequired
from .errors import HTTPException, RateLimited, Forbidden, NotFound, LoginFailure, DiscordServerError, GatewayNotFound, CaptchaRequired
from .file import File
from .tracking import ContextProperties
from . import utils
@ -4050,7 +4050,10 @@ class HTTPClient:
# Misc
async def get_gateway(self, *, encoding: str = 'json', zlib: bool = True) -> str:
data = await self.request(Route('GET', '/gateway'))
try:
data = await self.request(Route('GET', '/gateway'))
except HTTPException as exc:
raise GatewayNotFound() from exc
if zlib:
value = '{0}?encoding={1}&v={2}&compress=zlib-stream'
else:

3
docs/api.rst

@ -7628,6 +7628,8 @@ The following exceptions are thrown by the library.
.. autoexception:: InvalidData
.. autoexception:: GatewayNotFound
.. autoexception:: ConnectionClosed
.. autoexception:: discord.opus.OpusError
@ -7645,6 +7647,7 @@ Exception Hierarchy
- :exc:`InvalidData`
- :exc:`LoginFailure`
- :exc:`ConnectionClosed`
- :exc:`GatewayNotFound`
- :exc:`HTTPException`
- :exc:`Forbidden`
- :exc:`NotFound`

Loading…
Cancel
Save