Skip to content

Commit

Permalink
* Report "unsupported media type" as dialogless error when loading at…
Browse files Browse the repository at this point in the history
…tachments.
  • Loading branch information
iProgramMC committed May 31, 2024
1 parent af98d9d commit 33a104f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/discord/DiscordInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,10 @@ void DiscordInstance::HandleRequest(void* pRequestPtr)

case HTTP_NOTFOUND:
case HTTP_BADGATEWAY:
case HTTP_UNSUPPMEDIA:
{
DbgPrintF("Resource %s not loaded due to error %d", pRequest->url, pRequest->result);

if (pRequest->itype == IMAGE || pRequest->itype == IMAGE_ATTACHMENT) {
GetFrontend()->OnAttachmentFailed(pRequest->itype == IMAGE, pRequest->additional_data);
return;
Expand All @@ -526,6 +529,9 @@ void DiscordInstance::HandleRequest(void* pRequestPtr)
case HTTP_BADGATEWAY:
suffix = " could not be accessed due to a bad gateway. (502)";
break;
case HTTP_UNSUPPMEDIA:
suffix = " could not be accessed due to an unsupported media type. (415)";
break;
}

str = "The following resource " + pRequest->url + suffix;
Expand Down
1 change: 1 addition & 0 deletions src/discord/HTTPClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum eHttpResponseCodes
HTTP_UNAUTHORIZED = 401,
HTTP_FORBIDDEN = 403,
HTTP_NOTFOUND = 404,
HTTP_UNSUPPMEDIA = 415,
HTTP_TOOMANYREQS = 429,

HTTP_BADGATEWAY = 502,
Expand Down

0 comments on commit 33a104f

Please sign in to comment.