]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: don't log tracebacks on 404s 47093/head
authorErnesto Puerta <epuertat@redhat.com>
Wed, 29 Jun 2022 18:09:21 +0000 (20:09 +0200)
committerErnesto Puerta <epuertat@redhat.com>
Thu, 14 Jul 2022 09:07:25 +0000 (11:07 +0200)
Currently we're logging tracebacks on expected request errors as 404,
401, etc. This may cause confusion to users, which might think that
something really wrong was happening there.

This should be extended to many DashboardExceptions that simply return
expected HTTP error codes (403, 415, 3xx, etc).

Fixes: https://tracker.ceph.com/issues/55720
Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
(cherry picked from commit 3928fe91a4b8c313a52e38cab9ba31e54ff1ae51)

src/pybind/mgr/dashboard/services/exception.py

index c280e17d4371be389dfac37e023b4c387a089790..2ac53c94a86a63072d0c412e7cb88b34058aa36a 100644 (file)
@@ -45,15 +45,14 @@ 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.
+    # pylint: disable=try-except-raise
+    except (cherrypy.HTTPRedirect, cherrypy.NotFound, cherrypy.HTTPError):
+        raise
     except (ViewCacheNoDataException, DashboardException) as error:
         logger.exception('Dashboard Exception')
         cherrypy.response.headers['Content-Type'] = 'application/json'
         cherrypy.response.status = getattr(error, 'status', 400)
         return json.dumps(serialize_dashboard_exception(error)).encode('utf-8')
-    except cherrypy.HTTPRedirect:
-        # No internal errors
-        raise
     except Exception as error:
         logger.exception('Internal Server Error')
         raise error