Improve protection against old unsupported objects (e.g. LocationSourceForCallsign.NONE) coming back from the cache and throwing exceptions

This commit is contained in:
Ian Renton
2026-09-18 07:28:29 +01:00
parent 29eea1edc0
commit 4261c60d74
10 changed files with 38 additions and 25 deletions
@@ -42,7 +42,13 @@ class CallsignDataProvider:
if self.enabled:
if callsign in self._storage:
return self._storage[callsign]
try:
return self._storage[callsign]
except (ValueError, KeyError):
# Catch exceptions due to e.g. old versions of objects in the cache that are no longer compatible,
# and remove them from the cache.
del self._storage[callsign]
return None
else:
c = self._perform_new_lookup(callsign, lookup_credentials)
if c: