Now using common base class for exceptions.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 27 Jul 2016 18:24:17 +0000 (20:24 +0200)
committergregor herrmann <gregoa@debian.org>
Wed, 27 Jul 2016 22:21:38 +0000 (00:21 +0200)
bin/tdyndns_update

index 8f943f8..ce0b73a 100755 (executable)
@@ -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)