Upgrade exception filter

This commit is contained in:
Ske 2021-03-18 20:16:28 +01:00
parent 3196f60093
commit cddecb7558

View File

@ -12,6 +12,8 @@ using Npgsql;
using PluralKit.Core; using PluralKit.Core;
using Polly.Timeout;
namespace PluralKit.Bot namespace PluralKit.Bot
{ {
public static class MiscUtils { public static class MiscUtils {
@ -68,6 +70,11 @@ namespace PluralKit.Bot
if (e is NotFoundException ne && ne.ResponseBody.Contains("<center>nginx</center>")) return false; if (e is NotFoundException ne && ne.ResponseBody.Contains("<center>nginx</center>")) return false;
if (e is UnauthorizedException ue && ue.ResponseBody.Contains("<center>nginx</center>")) return false; if (e is UnauthorizedException ue && ue.ResponseBody.Contains("<center>nginx</center>")) return false;
// Filter out timeout/ratelimit related stuff
if (e is TooManyRequestsException) return false;
if (e is RatelimitBucketExhaustedException) return false;
if (e is TimeoutRejectedException) return false;
// 5xxs? also not our problem :^) // 5xxs? also not our problem :^)
if (e is UnknownDiscordRequestException udre && (int) udre.StatusCode >= 500) return false; if (e is UnknownDiscordRequestException udre && (int) udre.StatusCode >= 500) return false;