Skip to content

Commit

Permalink
Catch Missing File Error
Browse files Browse the repository at this point in the history
  • Loading branch information
canewsin committed Jan 8, 2022
1 parent 90b6cb9 commit 5e61fe8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Site/SiteStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,12 @@ def onUpdated(self, inner_path, file=None):
# 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):
Expand Down

0 comments on commit 5e61fe8

Please sign in to comment.