fix: Add edge case tests and improve write permissions error

This commit is contained in:
Marty Oehme 2025-12-08 17:22:26 +01:00
parent a2c5cf281b
commit 0820b686e5
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 70 additions and 1 deletions

View file

@ -63,7 +63,12 @@ def main(cfg: "TConf | None" = None, io: "_IO | None" = None) -> int:
fpath = get_notes_file(uuid, notes_dir=cfg.notes_dir, notes_ext=cfg.notes_ext)
_ensure_parent_dir(fpath)
try:
_ensure_parent_dir(fpath)
except PermissionError:
io.err(f"Could not write required directories for path: {fpath}.\n")
return 1
io.out(f"Editing note: {fpath}")
open_editor(fpath, editor=cfg.notes_editor, io=io)