diff --git a/Weather/Service/MessageHandler.cs b/Weather/Service/MessageHandler.cs index 53f777b..b23b227 100644 --- a/Weather/Service/MessageHandler.cs +++ b/Weather/Service/MessageHandler.cs @@ -100,14 +100,23 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service _database.StoreWeatherData(weatherMessage); - if (_hubConnection.State == HubConnectionState.Disconnected) - _hubConnection.StartAsync().Wait(); + try + { + if (_hubConnection.State == HubConnectionState.Disconnected) + _hubConnection.StartAsync().Wait(); - _hubConnection.InvokeAsync("SendLatestReading", message).Wait(); + _hubConnection.InvokeAsync("SendLatestReading", message).Wait(); + } + catch (Exception exception) + { + WriteLog($"Hub exception: {exception}"); + } } catch (Exception exception) { WriteLog($"Exception: {exception}"); + + throw; } }