From 92bdfd6caccfab92397045e19800842257ed0600 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 12 Jan 2026 16:18:38 +0530 Subject: [PATCH] fix: catch initiate call exception in public agent --- api/routes/public_agent.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/api/routes/public_agent.py b/api/routes/public_agent.py index d82cadc..97501e9 100644 --- a/api/routes/public_agent.py +++ b/api/routes/public_agent.py @@ -159,11 +159,20 @@ async def initiate_call( ) # 10. Initiate call via telephony provider - await provider.initiate_call( - to_number=request.phone_number, - webhook_url=webhook_url, - workflow_run_id=workflow_run.id, - ) + try: + await provider.initiate_call( + to_number=request.phone_number, + webhook_url=webhook_url, + workflow_run_id=workflow_run.id, + ) + except Exception as e: + logger.error( + f"Failed to initiate call for workflow run {workflow_run.id}: {e}" + ) + raise HTTPException( + status_code=400, + detail=f"Failed to initiate call: {e}", + ) logger.info( f"Call initiated successfully for workflow run {workflow_run.id} "