Fix bare except (#72906)
This commit is contained in:
parent
6ccaf33bdf
commit
62a5854e40
4 changed files with 5 additions and 5 deletions
|
@ -199,7 +199,7 @@ class StoredData:
|
|||
with self._lock, open(self._data_file, "rb") as myfile:
|
||||
self._data = pickle.load(myfile) or {}
|
||||
self._cache_outdated = False
|
||||
except: # noqa: E722 pylint: disable=bare-except
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.error(
|
||||
"Error loading data from pickled file %s", self._data_file
|
||||
)
|
||||
|
@ -221,6 +221,6 @@ class StoredData:
|
|||
)
|
||||
try:
|
||||
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)
|
||||
self._cache_outdated = True
|
||||
|
|
|
@ -306,7 +306,7 @@ class QNAPStatsAPI:
|
|||
self.data["smart_drive_health"] = self._api.get_smart_disk_health()
|
||||
self.data["volumes"] = self._api.get_volumes()
|
||||
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")
|
||||
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ async def test_description_xml(hass, hue_client):
|
|||
root = ET.fromstring(await result.text())
|
||||
ns = {"s": "urn:schemas-upnp-org:device-1-0"}
|
||||
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!")
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ async def get_error_log(hass_ws_client):
|
|||
def _generate_and_log_exception(exception, log):
|
||||
try:
|
||||
raise Exception(exception)
|
||||
except: # noqa: E722 pylint: disable=bare-except
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception(log)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue