Use correct exception handler here
This commit is contained in:
@@ -8,7 +8,7 @@ import click
|
|||||||
import configparser
|
import configparser
|
||||||
from airthings import fetch_measurements, discover_devices
|
from airthings import fetch_measurements, discover_devices
|
||||||
from influxdb import InfluxDBClient
|
from influxdb import InfluxDBClient
|
||||||
from influxdb.exceptions import InfluxDBClientError
|
from influxdb.exceptions import InfluxDBServerError
|
||||||
|
|
||||||
|
|
||||||
def read_config(file):
|
def read_config(file):
|
||||||
@@ -212,7 +212,7 @@ def start(ctx):
|
|||||||
try:
|
try:
|
||||||
client.write_points(data)
|
client.write_points(data)
|
||||||
click.echo("Sent!")
|
click.echo("Sent!")
|
||||||
except InfluxDBClientError as e:
|
except InfluxDBServerError as e:
|
||||||
click.echo("An error occured: %s" % e)
|
click.echo("An error occured: %s" % e)
|
||||||
click.echo("Storing data for now, waiting for the next interval." % e)
|
click.echo("Storing data for now, waiting for the next interval." % e)
|
||||||
click.echo("Sleeping for %s seconds" % interval)
|
click.echo("Sleeping for %s seconds" % interval)
|
||||||
|
|||||||
Reference in New Issue
Block a user