Error Handling
Exception Types
exceptions.py
from proofly.exceptions import (
ValidationError,
ConfigurationError,
AnalysisError
)
Handling Errors
error-handling.py
try:
result = analyzer.analyze_metrics(
condition="diabetes",
metrics=DiabetesMetrics(
blood_glucose=500, # Above normal range
hba1c=6.5,
blood_pressure=130
)
)
except ValidationError as e:
print(f"Validation Error: {e.message}")
except ConfigurationError as e:
print(f"Configuration Error: {e.message}")
Common Error Scenarios
- ValidationError: Invalid metric values
- ConfigurationError: Missing API key or configuration
- AnalysisError: Analysis engine failures