diff --git a/src/backend/base/langflow/api/v1/endpoints.py b/src/backend/base/langflow/api/v1/endpoints.py index 7d3d32114..736a9ffb7 100644 --- a/src/backend/base/langflow/api/v1/endpoints.py +++ b/src/backend/base/langflow/api/v1/endpoints.py @@ -76,7 +76,6 @@ async def get_all( ) except Exception as exc: - logger.exception(exc) raise HTTPException(status_code=500, detail=str(exc)) from exc @@ -277,13 +276,10 @@ async def simplified_run_flow( raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=str(exc)) from exc if "not found" in str(exc): raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc - logger.exception(exc) raise APIException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, exception=exc, flow=flow) from exc except InvalidChatInputException as exc: - logger.exception(exc) raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=str(exc)) from exc except Exception as exc: - logger.exception(exc) background_tasks.add_task( telemetry_service.log_package_run, RunPayload( @@ -371,7 +367,6 @@ async def webhook_run_flow( ) if "Flow ID is required" in str(exc) or "Request body is empty" in str(exc): raise HTTPException(status_code=400, detail=str(exc)) from exc - logger.exception(exc) raise HTTPException(status_code=500, detail=str(exc)) from exc @@ -486,10 +481,8 @@ async def experimental_run_flow( if f"Session {session_id} not found" in str(exc): logger.exception(f"Session {session_id} not found") raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc - logger.exception(exc) raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(exc)) from exc except Exception as exc: - logger.exception(exc) raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(exc)) from exc @@ -650,7 +643,6 @@ async def custom_component_update( return component_node except Exception as exc: - logger.exception(exc) raise HTTPException(status_code=400, detail=str(exc)) from exc @@ -662,5 +654,4 @@ def get_config(): settings_service: SettingsService = get_settings_service() return settings_service.settings.model_dump() except Exception as exc: - logger.exception(exc) raise HTTPException(status_code=500, detail=str(exc)) from exc diff --git a/src/backend/base/langflow/api/v1/flows.py b/src/backend/base/langflow/api/v1/flows.py index 071b1641f..014250107 100644 --- a/src/backend/base/langflow/api/v1/flows.py +++ b/src/backend/base/langflow/api/v1/flows.py @@ -358,7 +358,6 @@ async def delete_multiple_flows( db.commit() return {"deleted": len(flows_to_delete)} except Exception as exc: - logger.exception(exc) raise HTTPException(status_code=500, detail=str(exc)) from exc diff --git a/src/backend/base/langflow/api/v1/starter_projects.py b/src/backend/base/langflow/api/v1/starter_projects.py index 74a639565..8cfb1baef 100644 --- a/src/backend/base/langflow/api/v1/starter_projects.py +++ b/src/backend/base/langflow/api/v1/starter_projects.py @@ -1,5 +1,4 @@ from fastapi import APIRouter, Depends, HTTPException -from loguru import logger from langflow.graph.graph.schema import GraphDump from langflow.services.auth.utils import get_current_active_user @@ -19,5 +18,4 @@ def get_starter_projects( try: return get_starter_projects_dump() except Exception as exc: - logger.exception(exc) raise HTTPException(status_code=500, detail=str(exc)) from exc diff --git a/src/backend/base/langflow/api/v1/validate.py b/src/backend/base/langflow/api/v1/validate.py index aa3828c5e..eaa5d4bbe 100644 --- a/src/backend/base/langflow/api/v1/validate.py +++ b/src/backend/base/langflow/api/v1/validate.py @@ -44,5 +44,4 @@ def post_validate_prompt(prompt_request: ValidatePromptRequest): frontend_node=prompt_request.frontend_node, ) except Exception as e: - logger.exception(e) raise HTTPException(status_code=500, detail=str(e)) from e diff --git a/src/backend/base/langflow/base/prompts/api_utils.py b/src/backend/base/langflow/base/prompts/api_utils.py index 824a851ec..d23474304 100644 --- a/src/backend/base/langflow/base/prompts/api_utils.py +++ b/src/backend/base/langflow/base/prompts/api_utils.py @@ -174,7 +174,6 @@ def add_new_variables_to_template(input_variables, custom_fields, template, name custom_fields[name].append(variable) except Exception as exc: - logger.exception(exc) raise HTTPException(status_code=500, detail=str(exc)) from exc @@ -190,7 +189,6 @@ def remove_old_variables_from_template(old_custom_fields, input_variables, custo template.pop(variable, None) except Exception as exc: - logger.exception(exc) raise HTTPException(status_code=500, detail=str(exc)) from exc diff --git a/src/backend/base/langflow/graph/graph/base.py b/src/backend/base/langflow/graph/graph/base.py index f5e87cc68..e6ef774fa 100644 --- a/src/backend/base/langflow/graph/graph/base.py +++ b/src/backend/base/langflow/graph/graph/base.py @@ -1035,7 +1035,6 @@ class Graph: except KeyError as exc: logger.exception(exc) if "nodes" not in payload and "edges" not in payload: - logger.exception(exc) msg = f"Invalid payload. Expected keys 'nodes' and 'edges'. Found {list(payload.keys())}" raise ValueError(msg) from exc diff --git a/src/backend/base/langflow/main.py b/src/backend/base/langflow/main.py index 8a02b7c19..c41674e4b 100644 --- a/src/backend/base/langflow/main.py +++ b/src/backend/base/langflow/main.py @@ -208,12 +208,12 @@ def create_app(): @app.exception_handler(Exception) async def exception_handler(request: Request, exc: Exception): if isinstance(exc, HTTPException): - logger.error(f"HTTPException: {exc.detail}") + logger.error(f"HTTPException: {exc}", exc_info=exc) return JSONResponse( status_code=exc.status_code, content={"message": str(exc.detail)}, ) - logger.error(f"unhandled error: {exc}") + logger.error(f"unhandled error: {exc}", exc_info=exc) return JSONResponse( status_code=HTTPStatus.INTERNAL_SERVER_ERROR, content={"message": str(exc)},