From: Stefan Metzmacher Date: Tue, 5 Nov 2019 10:23:48 +0000 (+0100) Subject: python/netcmd/dns: improve exception handling in cmd_add_record() X-Git-Tag: ldb-2.2.0~1189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72bbd170fc326a4e0a9e953b23ad0b90d01742c5;p=thirdparty%2Fsamba.git python/netcmd/dns: improve exception handling in cmd_add_record() Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- diff --git a/python/samba/netcmd/dns.py b/python/samba/netcmd/dns.py index 330e2efbdcd..6faa54d1a8e 100644 --- a/python/samba/netcmd/dns.py +++ b/python/samba/netcmd/dns.py @@ -941,7 +941,9 @@ class cmd_add_record(Command): 0, server, zone, name, add_rec_buf, None) except WERRORError as e: if e.args[0] == werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: - raise CommandError('Zone does not exist; record could not be added.') + raise CommandError('Zone does not exist; record could not be added. zone[%s] name[%s]' % (zone, name)) + if e.args[0] == werror.WERR_DNS_ERROR_RECORD_ALREADY_EXISTS: + raise CommandError('Record already exist; record could not be added. zone[%s] name[%s]' % (zone, name)) raise e self.outf.write('Record added successfully\n')