just warn if Heapster is not deployed (Minikube is missing it)
This commit is contained in:
14
kube_ops_view/utils.py
Normal file
14
kube_ops_view/utils.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import requests.exceptions
|
||||
|
||||
|
||||
def get_short_error_message(e: Exception):
|
||||
'''Generate a reasonable short message why the HTTP request failed'''
|
||||
|
||||
if isinstance(e, requests.exceptions.RequestException) and e.response is not None:
|
||||
# e.g. "401 Unauthorized"
|
||||
return '{} {}'.format(e.response.status_code, e.response.reason)
|
||||
elif isinstance(e, requests.exceptions.ConnectionError):
|
||||
# e.g. "ConnectionError" or "ConnectTimeout"
|
||||
return e.__class__.__name__
|
||||
else:
|
||||
return str(e)
|
||||
Reference in New Issue
Block a user