fix: properly raise exceptions instead of returning them in chat.py (#20276)

Change 'return Exception(...)' to 'raise Exception(...)' in chat_completed() and chat_action() functions. Returning an exception object instead of raising it causes errors to be silently swallowed, breaking error propagation.
This commit is contained in:
Classic298
2025-12-31 14:38:47 +01:00
committed by GitHub
parent 201c38a08a
commit b91e8b73ab

View File

@@ -310,7 +310,7 @@ async def chat_completed(request: Request, form_data: dict, user: Any):
try:
data = await process_pipeline_outlet_filter(request, data, user, models)
except Exception as e:
return Exception(f"Error: {e}")
raise Exception(f"Error: {e}")
metadata = {
"chat_id": data["chat_id"],
@@ -346,7 +346,7 @@ async def chat_completed(request: Request, form_data: dict, user: Any):
)
return result
except Exception as e:
return Exception(f"Error: {e}")
raise Exception(f"Error: {e}")
async def chat_action(request: Request, action_id: str, form_data: dict, user: Any):
@@ -442,6 +442,6 @@ async def chat_action(request: Request, action_id: str, form_data: dict, user: A
data = action(**params)
except Exception as e:
return Exception(f"Error: {e}")
raise Exception(f"Error: {e}")
return data