aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorWolfgang Müller2021-05-01 13:14:35 +0200
committerWolfgang Müller2021-05-01 13:14:35 +0200
commit18fcb77f9543efb2a83c4777f8ee6bc2a2b7c002 (patch)
tree4227d10319f3c9d6d2d3e0d78664aa6d8c086af3
parentc9c1d4849c0465321940dac36652e558437d0ebe (diff)
downloadquarg-18fcb77f9543efb2a83c4777f8ee6bc2a2b7c002.tar.gz
actions: Error out when the range for --around is missing
Previously this case was handled by the int() cast in the try/except block but resulted in a confusing error message. Make clear to the user what exactly went wrong.
-rw-r--r--quarg/actions.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/quarg/actions.py b/quarg/actions.py
index e1fbc57..528d515 100644
--- a/quarg/actions.py
+++ b/quarg/actions.py
@@ -46,6 +46,9 @@ class ParseAround(argparse.Action):
def __call__(self, parser, namespace, aroundspec, option_string=None):
if '/' in aroundspec:
datespec, rangespec = aroundspec.split('/', 1)
+ if not rangespec:
+ errx('Missing range for --around')
+
try:
hour_range = int(rangespec)
except ValueError as err: