Skip to content
Snippets Groups Projects
Commit 98313840 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

don't crash if state file doesn't exist

parent b5c67304
No related branches found
No related tags found
No related merge requests found
......@@ -210,7 +210,12 @@ class State(object):
@last.setter
def last(self, new_last: Union[float, None]):
if not new_last or new_last < 0:
os.unlink(self.cache_filenames['state'])
try:
os.unlink(self.cache_filenames['state'])
except OSError:
logger.exception(
f'unable to delete state file {self.cache_filenames["state"]}')
return
else:
State._save_json(
self.cache_filenames['state'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment