diff --git a/ennstatus/api/model.py b/ennstatus/api/model.py --- a/ennstatus/api/model.py +++ b/ennstatus/api/model.py @@ -235,7 +235,10 @@ class Server: except requests.HTTPError as e: raise e else: - data = data.json()['relays'][0] + 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']) diff --git a/ennstatus/api/views.py b/ennstatus/api/views.py --- a/ennstatus/api/views.py +++ b/ennstatus/api/views.py @@ -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()