mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Fix bare except (#72906)
This commit is contained in:
parent
6ccaf33bdf
commit
62a5854e40
@ -199,7 +199,7 @@ class StoredData:
|
|||||||
with self._lock, open(self._data_file, "rb") as myfile:
|
with self._lock, open(self._data_file, "rb") as myfile:
|
||||||
self._data = pickle.load(myfile) or {}
|
self._data = pickle.load(myfile) or {}
|
||||||
self._cache_outdated = False
|
self._cache_outdated = False
|
||||||
except: # noqa: E722 pylint: disable=bare-except
|
except Exception: # pylint: disable=broad-except
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Error loading data from pickled file %s", self._data_file
|
"Error loading data from pickled file %s", self._data_file
|
||||||
)
|
)
|
||||||
@ -221,6 +221,6 @@ class StoredData:
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
pickle.dump(self._data, myfile)
|
pickle.dump(self._data, myfile)
|
||||||
except: # noqa: E722 pylint: disable=bare-except
|
except Exception: # pylint: disable=broad-except
|
||||||
_LOGGER.error("Error saving pickled data to %s", self._data_file)
|
_LOGGER.error("Error saving pickled data to %s", self._data_file)
|
||||||
self._cache_outdated = True
|
self._cache_outdated = True
|
||||||
|
@ -306,7 +306,7 @@ class QNAPStatsAPI:
|
|||||||
self.data["smart_drive_health"] = self._api.get_smart_disk_health()
|
self.data["smart_drive_health"] = self._api.get_smart_disk_health()
|
||||||
self.data["volumes"] = self._api.get_volumes()
|
self.data["volumes"] = self._api.get_volumes()
|
||||||
self.data["bandwidth"] = self._api.get_bandwidth()
|
self.data["bandwidth"] = self._api.get_bandwidth()
|
||||||
except: # noqa: E722 pylint: disable=bare-except
|
except Exception: # pylint: disable=broad-except
|
||||||
_LOGGER.exception("Failed to fetch QNAP stats from the NAS")
|
_LOGGER.exception("Failed to fetch QNAP stats from the NAS")
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ async def test_description_xml(hass, hue_client):
|
|||||||
root = ET.fromstring(await result.text())
|
root = ET.fromstring(await result.text())
|
||||||
ns = {"s": "urn:schemas-upnp-org:device-1-0"}
|
ns = {"s": "urn:schemas-upnp-org:device-1-0"}
|
||||||
assert root.find("./s:device/s:serialNumber", ns).text == "001788FFFE23BFC2"
|
assert root.find("./s:device/s:serialNumber", ns).text == "001788FFFE23BFC2"
|
||||||
except: # noqa: E722 pylint: disable=bare-except
|
except Exception: # pylint: disable=broad-except
|
||||||
pytest.fail("description.xml is not valid XML!")
|
pytest.fail("description.xml is not valid XML!")
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ async def get_error_log(hass_ws_client):
|
|||||||
def _generate_and_log_exception(exception, log):
|
def _generate_and_log_exception(exception, log):
|
||||||
try:
|
try:
|
||||||
raise Exception(exception)
|
raise Exception(exception)
|
||||||
except: # noqa: E722 pylint: disable=bare-except
|
except Exception: # pylint: disable=broad-except
|
||||||
_LOGGER.exception(log)
|
_LOGGER.exception(log)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user