From fbdf6842542432be2012b81530136271a178b39d Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Mon, 9 Oct 2017 12:12:08 +0200 Subject: [PATCH] [mod] add failure handling mechanism for json decoding --- src/yunohost/dyndns.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/yunohost/dyndns.py b/src/yunohost/dyndns.py index be37072f9..d596e2525 100644 --- a/src/yunohost/dyndns.py +++ b/src/yunohost/dyndns.py @@ -299,8 +299,15 @@ def _migrate_from_md5_tsig_to_sha512_tsig(private_key_path, domain, dyn_host): if r.status_code != 201: print r.text - error = json.loads(r.text)['error'] - print "ERROR:", error + try: + error = json.loads(r.text)['error'] + print "ERROR:", error + except Exception as e: + import traceback + traceback.print_exc() + print e + error = r.text + # raise MoulinetteError(errno.EPERM, # m18n.n('dyndns_registration_failed', error=error)) # XXX print warning