]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: log useful information from internal server errors 36564/head
authorAlfonso Martínez <almartin@redhat.com>
Wed, 12 Aug 2020 11:22:27 +0000 (13:22 +0200)
committerAlfonso Martínez <almartin@redhat.com>
Wed, 12 Aug 2020 11:22:27 +0000 (13:22 +0200)
Fixes: https://tracker.ceph.com/issues/46899
Signed-off-by: Alfonso Martínez <almartin@redhat.com>
src/pybind/mgr/dashboard/services/exception.py

index 61ec52d451d4ec4e8d5213311e315bb0058a840f..089491aec31399ebe9d447b66bcb69cf4a2b28f5 100644 (file)
@@ -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