diff --git a/lib/galaxy/webapps/base/api.py b/lib/galaxy/webapps/base/api.py index 7923fc297331..6cad53654899 100644 --- a/lib/galaxy/webapps/base/api.py +++ b/lib/galaxy/webapps/base/api.py @@ -1,3 +1,4 @@ +import logging import os import stat import typing @@ -32,6 +33,9 @@ ) +log = logging.getLogger(__name__) + + # Copied from https://github.com/tiangolo/fastapi/issues/1240#issuecomment-1055396884 def _get_range_header(range_header: str, file_size: int) -> typing.Tuple[int, int]: def _invalid_range(): @@ -189,6 +193,10 @@ async def validate_exception_middleware(request: Request, exc: RequestValidation @app.exception_handler(MessageException) async def message_exception_middleware(request: Request, exc: MessageException) -> Response: + # Intentionally not logging traceback here, though we could. This + # exception will also be dispatched to Sentry, this just makes logs less + # opaque when one sees a 500. + log.error(f"MessageException: {exc}") return get_error_response_for_request(request, exc)