monitor: Catch any failure to coerce gameversion

Also, log either the error or the success.  That will aid us in diagnosing
any future issues.
This commit is contained in:
Athanasius committed 2022-11-27 13:02:54 +00:00
1 parent 8a58220a66
commit b3eff6ab32
1 file changed
+14 -1
+14 -1
View File
@@ -1686,7 +1686,20 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
self.state['GameVersion'] = entry['gameversion']
self.state['GameBuild'] = entry['build']
self.version = self.state['GameVersion']
self.version_semantic = semantic_version.Version.coerce(self.state['GameVersion'])
try:
self.version_semantic = semantic_version.Version.coerce(self.state['GameVersion'])
except Exception:
# Catching all Exceptions as this is *one* call, and we won't
# get caught out by any semantic_version changes.
self.version_semantic = None
logger.error(f"Couldn't coerce {self.state['GameVersion']=}")
pass
else:
logger.info(f"Parsed {self.state['GameVersion']=} into {self.version_semantic=}")
self.is_beta = any(v in self.version.lower() for v in ('alpha', 'beta')) # type: ignore
except KeyError:
if not suppress: