[fix] unreferenced exceptions

This commit is contained in:
Laurent Peuch 2015-11-01 13:00:15 +01:00
parent 21b67ee7d0
commit 2d88ab9a24

View file

@ -96,7 +96,7 @@ def dyndns_subscribe(subscribe_host="dyndns.yunohost.org", domain=None, key=None
# Send subscription # Send subscription
try: try:
r = requests.post('https://%s/key/%s' % (subscribe_host, base64.b64encode(key)), data={ 'subdomain': domain }) r = requests.post('https://%s/key/%s' % (subscribe_host, base64.b64encode(key)), data={ 'subdomain': domain })
except ConnectionError: except requests.ConnectionError:
raise MoulinetteError(errno.ENETUNREACH, m18n.n('no_internet_connection')) raise MoulinetteError(errno.ENETUNREACH, m18n.n('no_internet_connection'))
if r.status_code != 201: if r.status_code != 201:
try: error = json.loads(r.text)['error'] try: error = json.loads(r.text)['error']
@ -129,7 +129,7 @@ def dyndns_update(dyn_host="dynhost.yunohost.org", domain=None, key=None, ip=Non
if ip is None: if ip is None:
try: try:
new_ip = requests.get('http://ip.yunohost.org').text new_ip = requests.get('http://ip.yunohost.org').text
except ConnectionError: except requests.ConnectionError:
raise MoulinetteError(errno.ENETUNREACH, m18n.n('no_internet_connection')) raise MoulinetteError(errno.ENETUNREACH, m18n.n('no_internet_connection'))
else: else:
new_ip = ip new_ip = ip