From 4410255c63b75e8a119d237432cabe972cb33359 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Thu, 19 Sep 2024 20:31:38 +0200 Subject: Handle OSErrors when writing out the title cache We handle these when reading the file, so we might as well do it here. --- later | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/later b/later index 59220af..3d43578 100755 --- a/later +++ b/later @@ -118,8 +118,11 @@ class TitleMap: os.makedirs(later_cache_dir, exist_ok=True) - with open(self.path, "w") as handle: - json.dump(self.map, handle) + try: + with open(self.path, "w") as handle: + json.dump(self.map, handle) + except OSError as err: + sys.exit(f"later: {err}") def entries(): -- cgit v1.2.3-2-gb3c3