From 5b1b36140758350485afe93d62d88f45407dd3cf Mon Sep 17 00:00:00 2001 From: Antoni Segura Puimedon Date: Tue, 10 Feb 2015 12:55:37 +0100 Subject: 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 --- wee_slack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wee_slack.py') 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 -- cgit