mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-10 03:27:57 +00:00
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:
parent
201c38a08a
commit
b91e8b73ab
1 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue