[config] improve --config-status

- remove 'Not Present' output
- add debug logs for exceptions
- use correct type when reporting invalid data
This commit is contained in:
Mike Fährmann
2026-02-05 20:10:31 +01:00
parent d3adfd603b
commit cf6dc2e83d

View File

@@ -155,13 +155,15 @@ def status():
with open(path, encoding="utf-8") as fp:
_load(fp.read())
except FileNotFoundError:
status = "Not Present"
except OSError:
status = ""
except OSError as exc:
log.debug("%s: %s", exc.__class__.__name__, exc)
status = "Inaccessible"
except ValueError:
status = "Invalid JSON"
except ValueError as exc:
log.debug("%s: %s", exc.__class__.__name__, exc)
status = "Invalid " + _type.upper()
except Exception as exc:
log.debug(exc)
log.debug("%s: %s", exc.__class__.__name__, exc)
status = "Unknown"
else:
status = "OK"
@@ -169,7 +171,6 @@ def status():
paths.append((path, status))
fmt = f"{{:<{max(len(p[0]) for p in paths)}}} : {{}}\n".format
for path, status in paths:
stdout_write(fmt(path, status))