diff options
author | Wolfgang Müller | 2021-05-01 13:14:35 +0200 |
---|---|---|
committer | Wolfgang Müller | 2021-05-01 13:14:35 +0200 |
commit | 18fcb77f9543efb2a83c4777f8ee6bc2a2b7c002 (patch) | |
tree | 4227d10319f3c9d6d2d3e0d78664aa6d8c086af3 | |
parent | c9c1d4849c0465321940dac36652e558437d0ebe (diff) | |
download | quarg-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.
Diffstat (limited to '')
-rw-r--r-- | quarg/actions.py | 3 |
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: |