also catching connection error

This commit is contained in:
Nicholas St. Germain 2019-01-16 12:03:12 -06:00
parent 855816a576
commit 6a20889d1a

View file

@ -1,5 +1,6 @@
from logging import getLogger from logging import getLogger
from influxdb import InfluxDBClient from influxdb import InfluxDBClient
from requests.exceptions import ConnectionError
from influxdb.exceptions import InfluxDBServerError from influxdb.exceptions import InfluxDBServerError
@ -24,6 +25,6 @@ class DBManager(object):
self.logger.debug('Writing Data to InfluxDB %s', d) self.logger.debug('Writing Data to InfluxDB %s', d)
try: try:
self.influx.write_points(d) self.influx.write_points(d)
except InfluxDBServerError as e: except (InfluxDBServerError, ConnectionError) as e:
self.logger.error('Error writing data to influxdb. Dropping this set of data. Check your database! Error: ' self.logger.error('Error writing data to influxdb. Dropping this set of data. '
'%s', e) 'Check your database! Error: %s', e)