From 2fabdd2babf191b18f5d67eac863b4f90f408847 Mon Sep 17 00:00:00 2001 From: alyssa Date: Fri, 8 Nov 2024 06:50:02 +0900 Subject: [PATCH] fix(bot): don't show postgres connection errors to user --- PluralKit.Bot/Utils/MiscUtils.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PluralKit.Bot/Utils/MiscUtils.cs b/PluralKit.Bot/Utils/MiscUtils.cs index bb7a3aa7..5ee99901 100644 --- a/PluralKit.Bot/Utils/MiscUtils.cs +++ b/PluralKit.Bot/Utils/MiscUtils.cs @@ -89,12 +89,15 @@ public static class MiscUtils if (e is NpgsqlException tpe && tpe.InnerException is TimeoutException) return false; - // Ignore thread pool exhaustion errors - if (e is NpgsqlException npe && npe.Message.Contains("The connection pool has been exhausted")) - return false; - - // ignore "Exception while reading from stream" - if (e is NpgsqlException npe2 && npe2.Message.Contains("Exception while reading from stream")) + if (e is NpgsqlException npe && + ( + // Ignore thread pool exhaustion errors + npe.Message.Contains("The connection pool has been exhausted") + // ignore "Exception while reading from stream" + || npe.Message.Contains("Exception while reading from stream") + // ignore "Exception while connecting" + || npe.Message.Contains("Exception while connecting") + )) return false; return true;