diff options
author | Antoni Segura Puimedon <toni@midokura.com> | 2015-02-10 12:55:37 +0100 |
---|---|---|
committer | Antoni Segura Puimedon <toni@midokura.com> | 2015-02-10 13:04:23 +0100 |
commit | 5b1b36140758350485afe93d62d88f45407dd3cf (patch) | |
tree | 487f4268412ed207f733e28de486ae5391f4e95f /wee_slack.py | |
parent | d772cb4c42440b64398c0512c04d3a4731b2fdaa (diff) | |
download | wee-slack-5b1b36140758350485afe93d62d88f45407dd3cf.tar.gz |
Handle JSON decoding errors
JSON decoding errors raise ValueError instead of IOError. In such
cases, the best is to just act as if there was no cache previously.
Fixes #35
Signed-off-by: Antoni Segura Puimedon <toni@midokura.com>
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py index f558817..1863cc3 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1467,7 +1467,7 @@ if __name__ == "__main__": try: cache_file = open("{}/{}".format(WEECHAT_HOME, CACHE_NAME), 'r') message_cache = json.loads(cache_file.read()) - except IOError: + except (IOError, ValueError): message_cache = {} # End global var section |