Skip to content

Commit fb4a11f

Browse files
committed
Improve error handling in compile_and_fix_rust endpoint response
1 parent 0822d2f commit fb4a11f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,12 @@ async def compile_and_fix_rust(request: dict):
135135
return PlainTextResponse(content=output_text.strip())
136136
else:
137137
# For errors, return the JSON with detailed error information
138-
# Add the combined text to the response for easier client use
139-
result["combined_text"] = output_text.strip()
140-
return JSONResponse(content=result)
138+
return JSONResponse(content={
139+
"status": "error",
140+
"message": f"Failed to fix code: {result.get('build_output', '')}",
141+
"attempts": result.get("attempts", []),
142+
"combined_text": output_text.strip()
143+
})
141144

142145
async def handle_project_generation(
143146
project_id: str,

0 commit comments

Comments
 (0)