Spaces:
Sleeping
Sleeping
Download src/core/exceptions.py from abdullah9873/backend-rag-chatbot-v2: direct link, hf CLI and curl.
- Browser
- Download file 695 Bytes
-
https://huggingface.co/spaces/abdullah9873/backend-rag-chatbot-v2/resolve/main/src/core/exceptions.py
- Command line
-
hf download hf://spaces/abdullah9873/backend-rag-chatbot-v2/src/core/exceptions.py
-
curl -L -o exceptions.py https://huggingface.co/spaces/abdullah9873/backend-rag-chatbot-v2/resolve/main/src/core/exceptions.py
695 Bytes
| from fastapi import HTTPException, status | |
| class AgentError(HTTPException): | |
| def __init__(self, detail: str, status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR): | |
| super().__init__(status_code=status_code, detail=detail) | |
| class ToolExecutionError(AgentError): | |
| def __init__(self, tool_name: str, detail: str, status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR): | |
| super().__init__(status_code=status_code, detail=f"Tool '{tool_name}' failed: {detail}") | |
| class MCPError(AgentError): | |
| def __init__(self, detail: str, status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR): | |
| super().__init__(status_code=status_code, detail=f"MCP Server error: {detail}") | |