Nicer error message when there is a syntactical error in your config file.

This commit is contained in:
Manuel Ebert 2013-06-09 14:49:02 -07:00
parent ac7a882142
commit 90863ecee1
2 changed files with 8 additions and 1 deletions

View file

@ -4,6 +4,8 @@ Changelog
#### 1.1.0
* [New] JSON export exports tags as well.
* [Improved] Nicer error message when there is a syntactical error in your config file.
#### 1.0.5
* [Improved] Backwards compatibility with `parsedatetime` 0.8.7

View file

@ -150,7 +150,12 @@ def cli():
config = install.install_jrnl(CONFIG_PATH)
else:
with open(CONFIG_PATH) as f:
config = json.load(f)
try:
config = json.load(f)
except ValueError as e:
print("[There seems to be something wrong with your jrnl config at {}: {}]".format(CONFIG_PATH, e.message))
print("[Entry was NOT added to your journal]")
sys.exit(-1)
install.update_config(config, config_path=CONFIG_PATH)
original_config = config.copy()