From c22a73e1d0d58ee2660caf62d4d71a651a3019d8 Mon Sep 17 00:00:00 2001 From: Marcelo Moreira de Mello Date: Wed, 23 Nov 2016 02:41:51 -0500 Subject: [PATCH] Removed raise statement to don't pollute the user log. (#4536) * Removed raise statement to don't polute the user log. Only the error message should be displayed. Nov 22 11:28:32 tchellopi hass[20138]: 16-11-22 11:28:32 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Nov 22 11:28:32 tchellopi hass[20138]: Traceback (most recent call last): Nov 22 11:28:32 tchellopi hass[20138]: File "/usr/local/lib/python3.5/asyncio/tasks.py", line 241, in _step Nov 22 11:28:32 tchellopi hass[20138]: result = coro.throw(exc) Nov 22 11:28:32 tchellopi hass[20138]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 386, in _update_entity_states Nov 22 11:28:32 tchellopi hass[20138]: yield from update_coro Nov 22 11:28:32 tchellopi hass[20138]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 213, in async_update_ha_state Nov 22 11:28:32 tchellopi hass[20138]: yield from self.hass.loop.run_in_executor(None, self.update) Nov 22 11:28:32 tchellopi hass[20138]: File "/usr/local/lib/python3.5/asyncio/futures.py", line 361, in __iter__ Nov 22 11:28:32 tchellopi hass[20138]: yield self # This tells Task to wait for completion. Nov 22 11:28:32 tchellopi hass[20138]: File "/usr/local/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup Nov 22 11:28:32 tchellopi hass[20138]: future.result() Nov 22 11:28:32 tchellopi hass[20138]: File "/usr/local/lib/python3.5/asyncio/futures.py", line 274, in result Nov 22 11:28:32 tchellopi hass[20138]: raise self._exception Nov 22 11:28:32 tchellopi hass[20138]: File "/usr/local/lib/python3.5/concurrent/futures/thread.py", line 55, in run Nov 22 11:28:32 tchellopi hass[20138]: result = self.fn(*self.args, **self.kwargs) Nov 22 11:28:32 tchellopi hass[20138]: File "/home/hass/.homeassistant/custom_components/sensor/wunderground.py", line 187, in update Nov 22 11:28:32 tchellopi hass[20138]: self.rest.update() Nov 22 11:28:32 tchellopi hass[20138]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 296, in wrapper Nov 22 11:28:32 tchellopi hass[20138]: result = method(*args, **kwargs) Nov 22 11:28:32 tchellopi hass[20138]: File "/home/hass/.homeassistant/custom_components/sensor/wunderground.py", line 222, in update Nov 22 11:28:32 tchellopi hass[20138]: ["description"]) Nov 22 11:28:32 tchellopi hass[20138]: ValueError: you must supply a key * Updated unittest since we are just printing the error instead raising --- homeassistant/components/sensor/wunderground.py | 2 -- tests/components/sensor/test_wunderground.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/homeassistant/components/sensor/wunderground.py b/homeassistant/components/sensor/wunderground.py index 512a937650f..82bb3d3b245 100644 --- a/homeassistant/components/sensor/wunderground.py +++ b/homeassistant/components/sensor/wunderground.py @@ -222,7 +222,6 @@ class WUndergroundData(object): except ValueError as err: _LOGGER.error("Check WUnderground API %s", err.args) self.data = None - raise @Throttle(MIN_TIME_BETWEEN_UPDATES_ALERTS) def update_alerts(self): @@ -237,4 +236,3 @@ class WUndergroundData(object): except ValueError as err: _LOGGER.error("Check WUnderground API %s", err.args) self.alerts = None - raise diff --git a/tests/components/sensor/test_wunderground.py b/tests/components/sensor/test_wunderground.py index fb76b93885a..cde94558866 100644 --- a/tests/components/sensor/test_wunderground.py +++ b/tests/components/sensor/test_wunderground.py @@ -137,7 +137,7 @@ class TestWundergroundSetup(unittest.TestCase): ] } - self.assertFalse( + self.assertTrue( wunderground.setup_platform(self.hass, invalid_config, self.add_devices, None))