From c515a822f5115faa5128016a4a24c1195978bc56 Mon Sep 17 00:00:00 2001 From: PengfeiLi0218 Date: Tue, 29 Jan 2019 00:07:20 +0800 Subject: [PATCH] Error handling for KPI Dashboard of API Manager if CanGetConsumers, CanGetAnyUser is not present #65 --- apimanager/metrics/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apimanager/metrics/views.py b/apimanager/metrics/views.py index d7623a35..5b07a3aa 100644 --- a/apimanager/metrics/views.py +++ b/apimanager/metrics/views.py @@ -144,7 +144,9 @@ def get_metrics(self, cleaned_data): except APIError as err: error_once_only(self.request, err) except KeyError as err: - error_once_only(self.request, err) + error_once_only(self.request, metrics['message']) + except: + error_once_only(self.request, 'Unknown Error') return metrics def get_context_data(self, **kwargs):