From 37eae7fb8a1c3c382833f383f303578daf37adcc Mon Sep 17 00:00:00 2001 From: cgtobi Date: Thu, 9 Nov 2017 20:17:01 +0100 Subject: [PATCH] Improve error handling. (#10482) * Improve error handling. * Fix import of core requirements. * cleanup --- homeassistant/components/influxdb.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/influxdb.py b/homeassistant/components/influxdb.py index 1c261d5ec3e..b41deb5e5e3 100644 --- a/homeassistant/components/influxdb.py +++ b/homeassistant/components/influxdb.py @@ -5,9 +5,9 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/influxdb/ """ import logging - import re +import requests.exceptions import voluptuous as vol from homeassistant.const import ( @@ -123,10 +123,12 @@ def setup(hass, config): try: influx = InfluxDBClient(**kwargs) influx.query("SHOW SERIES LIMIT 1;", database=conf[CONF_DB_NAME]) - except exceptions.InfluxDBClientError as exc: + except (exceptions.InfluxDBClientError, + requests.exceptions.ConnectionError) as exc: _LOGGER.error("Database host is not accessible due to '%s', please " - "check your entries in the configuration file and that " - "the database exists and is READ/WRITE.", exc) + "check your entries in the configuration file (host, " + "port, etc.) and verify that the database exists and is " + "READ/WRITE.", exc) return False def influx_event_listener(event):