Exceptions
All SDK exceptions inherit from FaosError.
from faos import (
FaosError,
ShortcutError,
ShortcutNotFoundError,
ShortcutRateLimitError,
)
Exception Hierarchy
FaosError
└── ShortcutError
├── ShortcutNotFoundError
└── ShortcutRateLimitError
FaosError
Base exception for all FAOS SDK errors.
try:
response = await client.shortcut("invalid")
except FaosError as e:
print(f"FAOS error: {e}")
ShortcutError
Base exception for shortcut operations. Extends FaosError. This is an abstract base class with no additional properties — use the specific subclasses below for typed error handling.
ShortcutNotFoundError
Raised when a shortcut command cannot be resolved.
| Attribute | Type | Description |
|---|---|---|
command | str | The shortcut command that was not found |
suggestions | list[str] | Similar shortcuts the user may have intended |
from faos import ShortcutNotFoundError
try:
response = await client.shortcut("bnk credit-analyst")
except ShortcutNotFoundError as e:
print(f"Unknown: {e.command}")
print(f"Did you mean: {', '.join(e.suggestions)}")
# Output: Unknown: bnk credit-analyst
# Output: Did you mean: bank credit-analyst
ShortcutRateLimitError
Raised when API rate limit is exceeded.
| Attribute | Type | Description |
|---|---|---|
retry_after | float | None | Seconds to wait before retrying |
import asyncio
from faos import ShortcutRateLimitError
try:
response = await client.shortcut("bank credit-analyst")
except ShortcutRateLimitError as e:
if e.retry_after:
await asyncio.sleep(e.retry_after)
response = await client.shortcut("bank credit-analyst")