Skip to content

Commit 39c4c1e

Browse files
committed
Add ConnectionError exception for reading from the influxdb database.
1 parent 5b6c4fb commit 39c4c1e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mycodo/controller_pid.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import calendar
3333
import logging
3434
import datetime
35+
import requests
3536
import threading
3637
import time as t
3738
import timeit
@@ -274,10 +275,13 @@ def get_last_measurement(self):
274275
self.last_measurement_success = True
275276
else:
276277
self.logger.warning("No data returned from influxdb")
278+
except requests.ConnectionError:
279+
self.logger.exception("Failed to read measurement from the "
280+
"influxdb database: Could not connect.")
277281
except Exception as except_msg:
278282
self.logger.exception(
279-
"Failed to read measurement from the influxdb database: "
280-
"{err}".format(err=except_msg))
283+
"Exception while reading measurement from the influxdb "
284+
"database: {err}".format(err=except_msg))
281285

282286
def manipulate_relays(self):
283287
"""

0 commit comments

Comments
 (0)