aboutsummaryrefslogtreecommitdiff
path: root/discord/webhook.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-09-09 21:24:14 -0400
committerRapptz <[email protected]>2020-09-09 21:24:14 -0400
commit450e71f086b548cd294b7439d973befc9284193a (patch)
treed5c6e34f1b31a835e95f25f2bf4a891b235b7f19 /discord/webhook.py
parentGuard uses of the keep alive thread in case they're None (diff)
downloaddiscord.py-450e71f086b548cd294b7439d973befc9284193a.tar.xz
discord.py-450e71f086b548cd294b7439d973befc9284193a.zip
Add a more concrete exception for 500 status codes.
Fixes #5797
Diffstat (limited to 'discord/webhook.py')
-rw-r--r--discord/webhook.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/discord/webhook.py b/discord/webhook.py
index 7824c55a..bd280230 100644
--- a/discord/webhook.py
+++ b/discord/webhook.py
@@ -34,7 +34,7 @@ from urllib.parse import quote as _uriquote
import aiohttp
from . import utils
-from .errors import InvalidArgument, HTTPException, Forbidden, NotFound
+from .errors import InvalidArgument, HTTPException, Forbidden, NotFound, DiscordServerError
from .enums import try_enum, WebhookType
from .user import BaseUser, User
from .asset import Asset
@@ -241,7 +241,10 @@ class AsyncWebhookAdapter(WebhookAdapter):
raise NotFound(r, response)
else:
raise HTTPException(r, response)
+
# no more retries
+ if r.status >= 500:
+ raise DiscordServerError(r, response)
raise HTTPException(r, response)
async def handle_execution_response(self, response, *, wait):
@@ -342,7 +345,10 @@ class RequestsWebhookAdapter(WebhookAdapter):
raise NotFound(r, response)
else:
raise HTTPException(r, response)
+
# no more retries
+ if r.status >= 500:
+ raise DiscordServerError(r, response)
raise HTTPException(r, response)
def handle_execution_response(self, response, *, wait):