From: Alfonso Martínez Date: Wed, 12 Aug 2020 11:22:27 +0000 (+0200) Subject: mgr/dashboard: log useful information from internal server errors X-Git-Tag: v16.1.0~1441^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F36564%2Fhead;p=ceph.git mgr/dashboard: log useful information from internal server errors Fixes: https://tracker.ceph.com/issues/46899 Signed-off-by: Alfonso Martínez --- diff --git a/src/pybind/mgr/dashboard/services/exception.py b/src/pybind/mgr/dashboard/services/exception.py index 61ec52d451d4..089491aec313 100644 --- a/src/pybind/mgr/dashboard/services/exception.py +++ b/src/pybind/mgr/dashboard/services/exception.py @@ -41,16 +41,20 @@ def serialize_dashboard_exception(e, include_http_status=False, task=None): return out +# pylint: disable=broad-except def dashboard_exception_handler(handler, *args, **kwargs): try: with handle_rados_error(component=None): # make the None controller the fallback. return handler(*args, **kwargs) # Don't catch cherrypy.* Exceptions. - except (ViewCacheNoDataException, DashboardException) as e: + except (ViewCacheNoDataException, DashboardException) as error: logger.exception('Dashboard Exception') cherrypy.response.headers['Content-Type'] = 'application/json' - cherrypy.response.status = getattr(e, 'status', 400) - return json.dumps(serialize_dashboard_exception(e)).encode('utf-8') + cherrypy.response.status = getattr(error, 'status', 400) + return json.dumps(serialize_dashboard_exception(error)).encode('utf-8') + except Exception as error: + logger.exception('Internal Server Error') + raise error @contextmanager