From cdad070acbe1778fa96abe9b6444fe9a9b1e19d9 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Wed, 28 Jun 2023 11:38:20 +0200 Subject: [PATCH] feat: slightly improved error handling --- src/netcup_dns/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/netcup_dns/main.py b/src/netcup_dns/main.py index 4660a7d..75c39a7 100644 --- a/src/netcup_dns/main.py +++ b/src/netcup_dns/main.py @@ -70,7 +70,11 @@ def update_record_destination(api: Client, domain: str, hostname: str, type_: st :param destination: :return: True if `destination` differs from the old destination. """ - record = get_record(api, domain, hostname, type_) + try: + 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: # The new destination is identical with the current one. # Thus, we don't need to call the api.update_dns_record() method.