Add a more concrete exception for 500 status codes.

Fixes #5797
This commit is contained in:
Rapptz
2020-09-09 21:24:14 -04:00
parent f8808dba9b
commit 450e71f086
4 changed files with 24 additions and 4 deletions

View File

@ -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):