mirror of
https://codeberg.org/privacy1st/netcup-dns
synced 2024-12-22 23:36:04 +01:00
feat: slightly improved error handling
This commit is contained in:
parent
3ce2caede5
commit
cdad070acb
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user