Wrap 500 code in dashboard errors

Wrap HTTPInternalServerError to defend the dashboard from damage in case
of another services failure (e.g. glare).

Change-Id: I0e92beaa4ea0d1113ffb2534b83fd7e8df1d2711
Closes-Bug: #1615979
This commit is contained in:
Nikolay Starodubtsev 2016-09-12 16:37:58 +03:00
parent 9f7f0b6b36
commit 4528a4aaf3
1 changed files with 9 additions and 0 deletions

View File

@ -88,6 +88,15 @@ def handled_exceptions(request):
if not reason:
reason = msg
_handle_message(request, reason)
except (exc.HTTPInternalServerError,
glance_exc.HTTPInternalServerError) as e:
msg = _("There was an error communicating with server")
LOG.exception(msg)
reason = muranodashboard_utils.parse_api_error(
getattr(e, 'details', ''))
if not reason:
reason = msg
_handle_message(request, reason)
def _get_endpoint(request):