From 450e71f086b548cd294b7439d973befc9284193a Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 9 Sep 2020 21:24:14 -0400 Subject: Add a more concrete exception for 500 status codes. Fixes #5797 --- discord/webhook.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'discord/webhook.py') 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): -- cgit v1.2.3