From 0f5e00618b2a2bf7f3515e47632971aee26a9e4f Mon Sep 17 00:00:00 2001 From: gcarq Date: Fri, 2 Jun 2017 16:08:46 +0200 Subject: [PATCH] handle JSONDecodeError --- analyze.py | 1 - main.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/analyze.py b/analyze.py index ceac1a490..3bf7b8896 100644 --- a/analyze.py +++ b/analyze.py @@ -1,5 +1,4 @@ from datetime import timedelta -import time import arrow import matplotlib import logging diff --git a/main.py b/main.py index 868388290..983ecfc9a 100755 --- a/main.py +++ b/main.py @@ -1,5 +1,5 @@ #!/usr/bin/env python - +import json import logging import random import threading @@ -71,7 +71,7 @@ class TradeThread(threading.Thread): finally: Session.flush() time.sleep(25) - except RuntimeError: + except (RuntimeError, json.decoder.JSONDecodeError) as e: TelegramHandler.send_msg('*Status:* Got RuntimeError: ```\n{}\n```'.format(traceback.format_exc())) logger.exception('RuntimeError. Stopping trader ...') finally: