mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-02-16 10:58:32 -05:00
Catch and log all exceptions
This commit is contained in:
@@ -43,6 +43,8 @@ namespace ChrisKaczor.HomeMonitor.Power.Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void OnTimer(object state)
|
private void OnTimer(object state)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var client = new RestClient(_configuration["Power:Host"]);
|
var client = new RestClient(_configuration["Power:Host"]);
|
||||||
|
|
||||||
@@ -70,8 +72,6 @@ namespace ChrisKaczor.HomeMonitor.Power.Service
|
|||||||
if (_hubConnection == null)
|
if (_hubConnection == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_hubConnection.State == HubConnectionState.Disconnected)
|
if (_hubConnection.State == HubConnectionState.Disconnected)
|
||||||
_hubConnection.StartAsync().Wait();
|
_hubConnection.StartAsync().Wait();
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ namespace ChrisKaczor.HomeMonitor.Power.Service
|
|||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
WriteLog($"Hub exception: {exception}");
|
WriteLog($"Exception: {exception}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user