Better Error Messages for failing devices

This commit is contained in:
ig 2023-07-03 15:57:49 +02:00
parent 6648d318ca
commit 83cd63d390
3 changed files with 9 additions and 7 deletions

View File

@ -18,11 +18,13 @@ public class Battery48TlDevices
return new Battery48TlRecords(records);
}
catch (Exception e)
catch
{
Console.WriteLine(e);
//Console.WriteLine(e);
// TODO: log
"Failed to read Battery data".WriteLine();
return Battery48TlRecords.Null;
}

View File

@ -1,6 +1,7 @@
using InnovEnergy.Lib.Protocols.Modbus.Channels;
using InnovEnergy.Lib.Protocols.Modbus.Clients;
using InnovEnergy.Lib.Protocols.Modbus.Slaves;
using InnovEnergy.Lib.Utils;
namespace InnovEnergy.Lib.Devices.EmuMeter;
@ -25,10 +26,9 @@ public class EmuMeterDevice: ModbusDevice<EmuMeterRegisters>
{
return base.Read();
}
catch (Exception e)
catch
{
// TODO: Log
Console.WriteLine(e);
"Failed to read data from Inverters".WriteLine();
return null;
}
}

View File

@ -58,9 +58,9 @@ public class TruConvertDcDcDevices
return new DcDcDevicesRecord(scStatus, dcDcRecords);
}
catch (Exception e)
catch
{
Console.WriteLine(e);
"Failed to read DCDC data".WriteLine();
return new DcDcDevicesRecord(scStatus, Array.Empty<DcDcRecord>());
}
}