chore: Improve RequestError message details

Show exception type and cause when str(e) is empty for better debugging
This commit is contained in:
Chris Coutinho
2025-10-17 04:37:25 +02:00
parent 27519d0f62
commit dbcf9d93ca
+6 -1
View File
@@ -84,10 +84,15 @@ def configure_cookbook_tools(mcp: FastMCP):
recipe_id=recipe.id or "unknown",
)
except RequestError as e:
# RequestError can have empty str() - get details from exception attributes
error_detail = (
str(e)
or f"{type(e).__name__}: {getattr(e, '__cause__', 'unknown cause')}"
)
raise McpError(
ErrorData(
code=-1,
message=f"Network error importing recipe from {url}: {str(e)}",
message=f"Network error importing recipe from {url}: {error_detail}",
)
)
except HTTPStatusError as e: