File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,17 @@ async def generate(description: str, requirements: str) -> str:
2828async def compile_and_fix (code : str , description : str = "A Rust project" , max_attempts : int = 3 ) -> str :
2929 """Compile a Rust cargo project and fix any compiler errors"""
3030
31- async with httpx .AsyncClient () as client :
32- response = await client .post (f"{ API_BASE_URL } /compile-and-fix" ,
33- json = {'code' : code , 'description' : description , 'max_attempts' : max_attempts })
34- return response .text
31+ async with httpx .AsyncClient (timeout = 60.0 ) as client :
32+ try :
33+ response = await client .post (
34+ f"{ API_BASE_URL } /compile-and-fix" ,
35+ json = {'code' : code , 'description' : description , 'max_attempts' : max_attempts }
36+ )
37+ response .raise_for_status ()
38+ return response .text
39+ except httpx .HTTPError as e :
40+ print (f"HTTP error occurred: { e } " )
41+ return f"Error calling compile-and-fix API: { str (e )} "
3542
3643@mcp .tool ()
3744async def compile (code : str ) -> str :
You can’t perform that action at this time.
0 commit comments