diff --git a/update-record.py b/update-record.py index bffd72a..8de2d04 100755 --- a/update-record.py +++ b/update-record.py @@ -85,9 +85,13 @@ def main(args): - domain = args.domain + # do some checks + if (args.mode != 'delete' and not args.public_ip and not args.content): + raise ValueError("Missing content for domain entry.") + # end if # split domain + domain = args.domain h = domain.split('.') if (len(h) < 3): raise ValueError("invalid subdomain") @@ -141,19 +145,12 @@ args = parser.parse_args() - # do some checks - if (args.mode != 'delete' and not args.public_ip and not args.content): - raise ValueError("Missing content for domain entry.") - # end if - if (args.debug): main(args) else: try: main(args) - except NameError as e: - print(e.args[0]) - except RuntimeError as e: + except (NameError, RuntimeError, ValueError) as e: print(e.args[0]) # end try # end if