dynamicdns: Handle showing errors from GnuDIP

- Recently we have changed to using HTTP protocol for GnuDIP updates. These
involve using requests library. For exceptions raised by this library the
arguments may not all be JSON serializable. So, explicitly convert them into
strings.

Tests:

- Turn of network connection to the machine. Trigger a Dynamic DNS update by
re-submitting configuration form. This will results in an error message shown
in status table instead of an unhandled exception.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
Sunil Mohan Adapa authored and Joseph Nuthalapati committed 2025-09-05 22:00:04 +05:30
1 parent f94d8c661d
commit 4a0e35f806
1 file changed
+2 -2
+2 -2
View File
@@ -271,8 +271,8 @@ def set_status(domain, result, ip_address, error=None):
'domain': domain['domain'],
'result': result,
'ip_address': ip_address,
'error_code': error.__class__.__name__ if error else None,
'error_message': error.args[0] if error and error.args else None,
'error_code': str(error.__class__.__name__) if error else None,
'error_message': str(error.args[0]) if error and error.args else None,
'timestamp': int(time.time()),
}
kvstore.set('dynamicdns_status', json.dumps(status))