From cd6d813845655761a369f56201327c95eb901b7a Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 1 Sep 2021 23:11:18 +0200 Subject: [PATCH] Prevent logging reactor exceptions if expected due to cancellation --- src/Client.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 923e3ee..4b465e5 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -558,9 +558,10 @@ namespace WTelegram } catch (OperationCanceledException) { } - catch (Exception ex) when (!ct.IsCancellationRequested) + catch (Exception ex) { - Helpers.Log(5, $"An exception occured in the reactor: {ex}"); + if (!ct.IsCancellationRequested) + Helpers.Log(5, $"An exception occured in the reactor: {ex}"); } }