feat: slightly improved error handling

This commit is contained in:
Daniel Langbein 2023-06-28 11:38:20 +02:00
parent 3ce2caede5
commit cdad070acb

View File

@ -70,7 +70,11 @@ def update_record_destination(api: Client, domain: str, hostname: str, type_: st
:param destination: :param destination:
:return: True if `destination` differs from the old destination. :return: True if `destination` differs from the old destination.
""" """
try:
record = get_record(api, domain, hostname, type_) record = get_record(api, domain, hostname, type_)
except Exception as e:
raise Exception(f'Could not get DNS record for domain {domain}, hostname {hostname} and type {type_}') from e
if record.destination == destination: if record.destination == destination:
# The new destination is identical with the current one. # The new destination is identical with the current one.
# Thus, we don't need to call the api.update_dns_record() method. # Thus, we don't need to call the api.update_dns_record() method.