Spaces:
Build error
Build error
|
Download docs/contributing/error-handling.md from DataQuests/DeepCritical: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/spaces/DataQuests/DeepCritical/resolve/9b88c5693e4eef5cd1f2ddd36c396d6c8d952dce/docs/contributing/error-handling.md
- Command line
-
hf download hf://spaces/DataQuests/DeepCritical@9b88c5693e4eef5cd1f2ddd36c396d6c8d952dce/docs/contributing/error-handling.md
-
curl -L -o error-handling.md https://huggingface.co/spaces/DataQuests/DeepCritical/resolve/9b88c5693e4eef5cd1f2ddd36c396d6c8d952dce/docs/contributing/error-handling.md
1.38 kB
Error Handling & Logging
This document outlines error handling and logging conventions for The DETERMINATOR.
Exception Hierarchy
Use custom exception hierarchy (src/utils/exceptions.py):
Exception Hierarchy start_line:4 end_line:31
Error Handling Rules
- Always chain exceptions:
raise SearchError(...) from e - Log errors with context using
structlog:
logger.error("Operation failed", error=str(e), context=value)
- Never silently swallow exceptions
- Provide actionable error messages
Logging
- Use
structlogfor all logging (NOTprintorlogging) - Import:
import structlog; logger = structlog.get_logger() - Log with structured data:
logger.info("event", key=value) - Use appropriate levels: DEBUG, INFO, WARNING, ERROR
Logging Examples
logger.info("Starting search", query=query, tools=[t.name for t in tools])
logger.warning("Search tool failed", tool=tool.name, error=str(result))
logger.error("Assessment failed", error=str(e))
Error Chaining
Always preserve exception context:
try:
result = await api_call()
except httpx.HTTPError as e:
raise SearchError(f"API call failed: {e}") from e
See Also
- Code Style - Code style guidelines
- Testing - Testing guidelines