diff --git a/lib/galaxy/webapps/base/api.py b/lib/galaxy/webapps/base/api.py index 22793c85550b..3da3ba3d3900 100644 --- a/lib/galaxy/webapps/base/api.py +++ b/lib/galaxy/webapps/base/api.py @@ -201,7 +201,8 @@ async def message_exception_middleware(request: Request, exc: MessageException) # Intentionally not logging traceback here as the full context will be # dispatched to Sentry if configured. This just makes logs less opaque # when one sees a 500. - log.info(f"MessageException: {exc}") + if exc.status_code >= 500: + log.info(f"MessageException: {exc}") return get_error_response_for_request(request, exc)