From 026b856d6d00092a7e998c328cda23b77ffd811e Mon Sep 17 00:00:00 2001 From: Philipp Spitzer Date: Wed, 27 Jul 2016 20:24:17 +0200 Subject: [PATCH 1/1] Now using common base class for exceptions. --- bin/tdyndns_update | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/tdyndns_update b/bin/tdyndns_update index 8f943f8..ce0b73a 100755 --- a/bin/tdyndns_update +++ b/bin/tdyndns_update @@ -6,12 +6,16 @@ from subprocess import Popen, PIPE, call import ipaddr -class NsupdateError(Exception): +class ExternalProgramError(RuntimeError): + pass + + +class NsupdateError(ExternalProgramError): def __init__(self, returncode): self.returncode = returncode -class BlockipError(Exception): +class BlockipError(ExternalProgramError): def __init__(self, returncode): self.returncode = returncode @@ -82,7 +86,7 @@ def main(args): nsupdate_add(args.fqdn, args.ttl, args.ip) if ipfamily_by_ip(args.ip) == 'A': blockip_whitelist_add(args.ip) - except NsupdateError as e: + except ExternalProgramError as e: sys.exit(e.returncode) -- 2.30.2