Skip to content

Commit fed71c1

Browse files
committed
Print a descriptive error message when JSON config data is malformed
1 parent 4f49eea commit fed71c1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ue4cli/JsonDataManager.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from .UnrealManagerException import UnrealManagerException
12
from .Utility import Utility
23
import json, os, platform
34

@@ -27,7 +28,10 @@ def getDictionary(self):
2728
Retrieves the entire data dictionary
2829
"""
2930
if os.path.exists(self.jsonFile):
30-
return json.loads(Utility.readFile(self.jsonFile))
31+
try:
32+
return json.loads(Utility.readFile(self.jsonFile))
33+
except json.JSONDecodeError as err:
34+
raise UnrealManagerException('malformed JSON configuration file "{}" ({})'.format(self.jsonFile, err))
3135
else:
3236
return {}
3337

0 commit comments

Comments
 (0)