Improve error handling. (#10482)
* Improve error handling. * Fix import of core requirements. * cleanuppull/10494/head
parent
dd16b7cac3
commit
37eae7fb8a
|
@ -5,9 +5,9 @@ For more details about this component, please refer to the documentation at
|
||||||
https://home-assistant.io/components/influxdb/
|
https://home-assistant.io/components/influxdb/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
import requests.exceptions
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
@ -123,10 +123,12 @@ def setup(hass, config):
|
||||||
try:
|
try:
|
||||||
influx = InfluxDBClient(**kwargs)
|
influx = InfluxDBClient(**kwargs)
|
||||||
influx.query("SHOW SERIES LIMIT 1;", database=conf[CONF_DB_NAME])
|
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 "
|
_LOGGER.error("Database host is not accessible due to '%s', please "
|
||||||
"check your entries in the configuration file and that "
|
"check your entries in the configuration file (host, "
|
||||||
"the database exists and is READ/WRITE.", exc)
|
"port, etc.) and verify that the database exists and is "
|
||||||
|
"READ/WRITE.", exc)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def influx_event_listener(event):
|
def influx_event_listener(event):
|
||||||
|
|
Loading…
Reference in New Issue