Ignore hub exceptions but rethrow others

This commit is contained in:
2019-07-26 12:25:39 -04:00
parent b4c60489aa
commit c67caecdc0

View File

@@ -100,14 +100,23 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service
_database.StoreWeatherData(weatherMessage); _database.StoreWeatherData(weatherMessage);
try
{
if (_hubConnection.State == HubConnectionState.Disconnected) if (_hubConnection.State == HubConnectionState.Disconnected)
_hubConnection.StartAsync().Wait(); _hubConnection.StartAsync().Wait();
_hubConnection.InvokeAsync("SendLatestReading", message).Wait(); _hubConnection.InvokeAsync("SendLatestReading", message).Wait();
} }
catch (Exception exception) catch (Exception exception)
{
WriteLog($"Hub exception: {exception}");
}
}
catch (Exception exception)
{ {
WriteLog($"Exception: {exception}"); WriteLog($"Exception: {exception}");
throw;
} }
} }