diff --git a/backend/app/api/endpoints/ai_builder.py b/backend/app/api/endpoints/ai_builder.py index dcb0a966..c8771d16 100644 --- a/backend/app/api/endpoints/ai_builder.py +++ b/backend/app/api/endpoints/ai_builder.py @@ -195,6 +195,7 @@ async def scaffold( detail=f"AI returned invalid output: {e}", ) except Exception as e: + logger.exception("AI scaffold failed: %s: %s", type(e).__name__, e) await record_ai_usage( user_id=current_user.id, account_id=current_user.account_id, @@ -213,7 +214,7 @@ async def scaffold( await db.commit() raise HTTPException( status_code=status.HTTP_502_BAD_GATEWAY, - detail="AI provider error. Please try again.", + detail=f"AI provider error ({type(e).__name__}). Please try again.", ) # Record successful usage @@ -314,6 +315,7 @@ async def branch_detail( detail=f"AI returned invalid output: {e}", ) except Exception as e: + logger.exception("AI branch_detail failed: %s: %s", type(e).__name__, e) await record_ai_usage( user_id=current_user.id, account_id=current_user.account_id, @@ -332,7 +334,7 @@ async def branch_detail( await db.commit() raise HTTPException( status_code=status.HTTP_502_BAD_GATEWAY, - detail="AI provider error. Please try again.", + detail=f"AI provider error ({type(e).__name__}). Please try again.", ) # Record successful usage