From 5e61fe8b0698c7afaf0a681609447571d2e3bc5e Mon Sep 17 00:00:00 2001 From: canewsin Date: Sat, 8 Jan 2022 11:48:30 +0530 Subject: [PATCH] Catch Missing File Error --- src/Site/SiteStorage.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Site/SiteStorage.py b/src/Site/SiteStorage.py index 97f720dc..d5df8e95 100644 --- a/src/Site/SiteStorage.py +++ b/src/Site/SiteStorage.py @@ -388,8 +388,12 @@ class SiteStorage(object): # Load and parse json file @thread_pool_fs_read.wrap def loadJson(self, inner_path): - with self.open(inner_path, "r", encoding="utf8") as file: - return json.load(file) + try : + with self.open(inner_path) as file: + return json.load(file) + except Exception as err: + self.log.error("Json load error: %s" % Debug.formatException(err)) + return None # Write formatted json file def writeJson(self, inner_path, data):