autodns: proper error management for authentication error

This commit is contained in:
Alexandre Aubin 2021-09-18 13:58:41 +02:00
parent c8caabf8f8
commit 68f2eea0ae
2 changed files with 6 additions and 1 deletions

View file

@ -319,6 +319,7 @@
"domain_uninstall_app_first": "Those applications are still installed on your domain:\n{apps}\n\nPlease uninstall them using 'yunohost app remove the_app_id' or move them to another domain using 'yunohost app change-url the_app_id' before proceeding to domain removal",
"domain_registrar_is_not_configured": "The registrar is not yet configured for domain {domain}.",
"domain_dns_push_not_applicable": "The DNS push feature is not applicable to domain {domain}",
"domain_dns_push_failed_to_authenticate": "Failed to authenticate on registrar's API. Most probably the credentials are incorrect? (Error: {error})",
"domain_config_mail_in": "Incoming emails",
"domain_config_mail_out": "Outgoing emails",
"domain_config_xmpp": "XMPP",

View file

@ -605,7 +605,11 @@ def domain_dns_push(operation_logger, domain, dry_run=False, force=False, purge=
.with_dict(dict_object={"action": "list", "type": "all"})
)
client = LexiconClient(query)
try:
client.provider.authenticate()
except Exception as e:
raise YunohostValidationError("domain_dns_push_failed_to_authenticate", error=str(e))
try:
current_records = client.provider.list_records()
except Exception as e: