Skip to content

Commit

Permalink
fix: catch exception caused by empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepqr committed Feb 5, 2022
1 parent 557996f commit f49b1b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = ambient-archiver
version = 0.1.5
version = 0.1.6
description = Archive your data from ambientweather.net
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
2 changes: 2 additions & 0 deletions src/ambient/ambient.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def log_head_tail(data):
logging.info(
f"Got {len(data)} records from {data[-1]['date']} to {data[0]['date']}"
)
except IndexError:
logging.warn(f"Got no records.")
except KeyError:
logging.info(f"{data}")
raise ValueError("Data format invalid. Check api_key, application_key and mac.")
Expand Down

0 comments on commit f49b1b7

Please sign in to comment.