mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
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:
parent
f94d8c661d
commit
4a0e35f806
@ -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))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user