# Exceptions

## Exception Hierarchy

```
RuntimeError
└── AiFastDbError              # Base for all AiFastDb errors
    ├── StoreNotFoundError     # Store alias not registered
    ├── RecordNotFoundError    # Record ID not found
    ├── QueryError             # Query execution failure
    ├── WriteError             # Write operation failure
    ├── TransactionError       # Transaction (2PC) failure
    ├── StorageError           # Storage/persistence failure
    ├── CircuitBreakerError    # Circuit breaker is open
    └── RateLimitError         # Rate limit exceeded
```

## Usage

```python
from aifastdb import Federation, StoreNotFoundError, TransactionError

with Federation() as fed:
    try:
        fed.query("nonexistent", {"target": "person"})
    except StoreNotFoundError as e:
        print(f"Store not found: {e}")

    try:
        tx = fed.begin_transaction(["store1"])
        tx.commit()
    except TransactionError as e:
        print(f"Transaction failed: {e}")
```
