Skip to content

Commit

Permalink
Improve config error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
glutanimate committed Feb 27, 2018
1 parent d90f0fa commit 3e71fa8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/syntax_highlighting/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ def _addonMeta():

try:
meta = json.load(io.open(meta_path, encoding="utf-8"))
except (IOError, OSError, json.decoder.JSONDecodeError):
except (IOError, OSError):
meta = None
except json.decoder.JSONDecodeError as e:
print("Could not read meta.json: " + str(e))
meta = None

if not meta:
Expand Down Expand Up @@ -139,8 +142,8 @@ def _addonConfigDefaults():
try:
return json.load(io.open(defaults_path, encoding="utf-8"))
except (IOError, OSError, json.decoder.JSONDecodeError) as e:
raise Exception("External Editor for Text Files – "
"Config file could not be read: " + str(e))
print("Could not read config.json: " + str(e))
raise Exception("Config file could not be read: " + str(e))

def getConfig():
"""Get user config dictionary
Expand Down

0 comments on commit 3e71fa8

Please sign in to comment.