Commit e0e64bcd authored by w-e-w's avatar w-e-w

assert key created_at exist in config_states

parent 36ecff71
...@@ -31,10 +31,11 @@ def list_config_states(): ...@@ -31,10 +31,11 @@ def list_config_states():
try: try:
with open(path, "r", encoding="utf-8") as f: with open(path, "r", encoding="utf-8") as f:
j = json.load(f) j = json.load(f)
assert "created_at" in j, '"created_at" does not exist'
j["filepath"] = path j["filepath"] = path
config_states.append(j) config_states.append(j)
except Exception as e: except Exception as e:
print(f'[ERROR]{path}, {e}') print(f'[ERROR]: Config states {path}, {e}')
config_states = sorted(config_states, key=lambda cs: cs["created_at"], reverse=True) config_states = sorted(config_states, key=lambda cs: cs["created_at"], reverse=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment