better exception handling and minor changes

This commit is contained in:
gcarq
2017-05-19 18:02:18 +02:00
parent 775c2a1a9a
commit 763e05ff14
2 changed files with 14 additions and 10 deletions
+6 -3
View File
@@ -6,6 +6,8 @@ import threading
import time
import traceback
from datetime import datetime
from json import JSONDecodeError
from requests import ConnectionError
from wrapt import synchronized
@@ -22,7 +24,7 @@ from utils import get_conf
__author__ = "gcarq"
__copyright__ = "gcarq 2017"
__license__ = "GPLv3"
__version__ = "0.6.0"
__version__ = "0.6.1"
conf = get_conf()
@@ -61,8 +63,9 @@ class TradeThread(threading.Thread):
while not _should_stop:
try:
self._process()
except ValueError:
logger.exception('ValueError')
except (ConnectionError, JSONDecodeError, ValueError) as e:
msg = 'Got {} during _process()'.format(e.__class__.__name__)
logger.exception(msg)
finally:
Session.flush()
time.sleep(25)