From 4a0e35f806e53643e34fc893f4d1dc088f8966f2 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 18 Jul 2025 14:20:23 -0700 Subject: [PATCH] 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 Reviewed-by: Joseph Nuthalapati --- plinth/modules/dynamicdns/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plinth/modules/dynamicdns/__init__.py b/plinth/modules/dynamicdns/__init__.py index b895e37f8..64ccc9539 100644 --- a/plinth/modules/dynamicdns/__init__.py +++ b/plinth/modules/dynamicdns/__init__.py @@ -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))