From 01f1def61bd02111bd0ed9d2ffdac109b79e74da Mon Sep 17 00:00:00 2001 From: atef Date: Mon, 23 Oct 2023 10:05:06 +0200 Subject: [PATCH] update try catch on Ampt class --- csharp/Lib/Devices/AMPT/AmptDevices.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/csharp/Lib/Devices/AMPT/AmptDevices.cs b/csharp/Lib/Devices/AMPT/AmptDevices.cs index 7345c2c3c..04f6183f3 100644 --- a/csharp/Lib/Devices/AMPT/AmptDevices.cs +++ b/csharp/Lib/Devices/AMPT/AmptDevices.cs @@ -31,9 +31,11 @@ public class AmptDevices { return TryRead(); } - catch (Exception e) + catch ( Exception e) { - Console.WriteLine("Failed to read Ampt data \n" + e.Message); + if( e is not NullChannelException) + Console.WriteLine("Failed to read Ampt data \n" + e.Message); + return null; } }