Skip to content

Commit

Permalink
feat: Improve error handling in /stream route
Browse files Browse the repository at this point in the history
  • Loading branch information
dartpain committed Jun 20, 2024
1 parent 2e2149c commit 4dde7ea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion application/api/answer/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def complete_stream(question, retriever, conversation_id, user_api_key):
data = json.dumps({"type": "end"})
yield f"data: {data}\n\n"
except Exception as e:
data = json.dumps({"type": "error","error": str(e)})
data = json.dumps({"type": "error","error":"Please try again later. We apologize for any inconvenience.",
"error_exception": str(e)})
yield f"data: {data}\n\n"
return

Expand Down

0 comments on commit 4dde7ea

Please sign in to comment.