Ignore weird Nginx errors from Discord

This commit is contained in:
Ske 2020-05-12 22:19:33 +02:00
parent b9a89a1037
commit dee229b08c

View File

@ -30,6 +30,11 @@ namespace PluralKit.Bot
// The library tries to parse these HTML responses as JSON and crashes with a consistent exception message.
if (e is JsonReaderException jre && jre.Message == "Unexpected character encountered while parsing value: <. Path '', line 0, position 0.") return false;
// And now (2020-05-12), apparently Discord returns these weird responses occasionally. Also not our problem.
if (e is BadRequestException bre && bre.WebResponse.Response.Contains("<center>nginx</center>")) return false;
if (e is NotFoundException ne && ne.WebResponse.Response.Contains("<center>nginx</center>")) return false;
if (e is UnauthorizedException ue && ue.WebResponse.Response.Contains("<center>nginx</center>")) return false;
// Webhook server errors are also *not our problem*
// (this includes rate limit errors, WebhookRateLimited is a subclass)
if (e is WebhookExecutionErrorOnDiscordsEnd) return false;