Skip to content

Commit

Permalink
Print a descriptive error message when JSON config data is malformed
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrehn committed Mar 13, 2024
1 parent 4f49eea commit fed71c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ue4cli/JsonDataManager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .UnrealManagerException import UnrealManagerException
from .Utility import Utility
import json, os, platform

Expand Down Expand Up @@ -27,7 +28,10 @@ def getDictionary(self):
Retrieves the entire data dictionary
"""
if os.path.exists(self.jsonFile):
return json.loads(Utility.readFile(self.jsonFile))
try:
return json.loads(Utility.readFile(self.jsonFile))
except json.JSONDecodeError as err:
raise UnrealManagerException('malformed JSON configuration file "{}" ({})'.format(self.jsonFile, err))
else:
return {}

Expand Down

0 comments on commit fed71c1

Please sign in to comment.