From b7c0dcc402d9ff21920ca31676c7df317a0cf74a Mon Sep 17 00:00:00 2001 From: anirudhm22 Date: Sun, 22 Mar 2026 18:43:19 +0530 Subject: [PATCH] fix: preserve original exception type in FileClass write methods This fixes an issue where IOError were swallowed and incorrectly re-raised as IndexError in writeFile and writeFileUJson. Closes #353 --- API/Classes/Base/FileClass.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/API/Classes/Base/FileClass.py b/API/Classes/Base/FileClass.py index a4f07c8c4..3a75631fd 100644 --- a/API/Classes/Base/FileClass.py +++ b/API/Classes/Base/FileClass.py @@ -21,7 +21,7 @@ def writeFile(data, path): with open(path, mode="w") as f: f.write(json.dumps(data, ensure_ascii=True, indent=4, sort_keys=False)) except (IOError, IndexError): - raise IndexError + raise except OSError: raise OSError @@ -31,7 +31,7 @@ def writeFileUJson(data, path): with open(path, mode="w") as f: f.write(json.dumps(data)) except (IOError, IndexError): - raise IndexError + raise except OSError: raise OSError