Error Handling
Error Structure
class FoundryError(Exception):
code: str # Machine-readable error code
message: str # Human-readable message
details: dict # Additional context
recovery_hint: str # How to fix the issueError Types
DatasetNotFoundError
from foundry.errors import DatasetNotFoundError
try:
dataset = f.get_dataset("nonexistent-doi")
except DatasetNotFoundError as e:
print(e.code) # "DATASET_NOT_FOUND"
print(e.message) # "No dataset found matching..."
print(e.recovery_hint) # "Try a broader search term..."AuthenticationError
DownloadError
DataLoadError
ValidationError
PublishError
CacheError
ConfigurationError
Error Codes Reference
Code
Error Class
Common Causes
Handling Errors
Basic Pattern
Catch All Foundry Errors
Serialization for APIs
For AI Agents
Custom Error Handling
Retry Logic
Fallback Strategies
Last updated
Was this helpful?