Changeset - dd827e1dedde
[Not reviewed]
Dennis Fink - 9 years ago 2016-05-16 14:15:47
dennis.fink@c3l.lu
Fix IndexError
2 files changed with 6 insertions and 0 deletions:
0 comments (0 inline, 0 general)
ennstatus/api/model.py
Show inline comments
 
@@ -235,7 +235,10 @@ class Server:
 
        except requests.HTTPError as e:
 
            raise e
 
        else:
 
            try:
 
            data = data.json()['relays'][0]
 
            except IndexError as e:
 
                raise RuntimeError from e
 

	
 
        self.mean_consensus_weight = calculate_weight(data['consensus_weight'])
 
        self.mean_exit_probability = calculate_weight(data['exit_probability'])
ennstatus/api/views.py
Show inline comments
 
@@ -123,6 +123,9 @@ def update():
 
    except requests.HTTPError as e:
 
        current_app.logger.error(str(e), exc_info=True)
 
        pass
 
    except RuntimeError as e:
 
        current_app.logger.error(str(e), exc_info=True)
 
        pass
 

	
 
    try:
 
        server.save()
0 comments (0 inline, 0 general)