From 01457ef996c1063062b6c3ddddbdcba8fa576f17 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alfonso=20Mart=C3=ADnez?= Date: Wed, 12 Aug 2020 13:22:27 +0200 Subject: [PATCH] mgr/dashboard: log useful information from internal server errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: https://tracker.ceph.com/issues/46899 Signed-off-by: Alfonso Martínez --- src/pybind/mgr/dashboard/services/exception.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/dashboard/services/exception.py b/src/pybind/mgr/dashboard/services/exception.py index 61ec52d451d4e..089491aec3139 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 -- 2.39.5