From 18fcb77f9543efb2a83c4777f8ee6bc2a2b7c002 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Sat, 1 May 2021 13:14:35 +0200 Subject: 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. --- quarg/actions.py | 3 +++ 1 file changed, 3 insertions(+) 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: -- cgit v1.2.3-2-gb3c3