Exceptions API Reference#
Custom exceptions for the OpenIntent SDK.
Base Exceptions#
OpenIntentError
#
OpenIntentError(
message: str,
status_code: Optional[int] = None,
response: Optional[dict[str, Any]] = None,
)
Bases: Exception
Base exception for all OpenIntent SDK errors.
APIError
#
HTTP Errors#
NotFoundError
#
ConflictError
#
Bases: OpenIntentError
Raised when there's a version conflict during optimistic concurrency control.
ValidationError
#
AuthenticationError
#
Usage#
from openintent import OpenIntentClient
from openintent.exceptions import ConflictError, NotFoundError
client = OpenIntentClient(base_url="...", agent_id="...")
try:
client.patch_state(intent_id, {"key": "value"})
except ConflictError:
# Version mismatch - need to refresh and retry
intent = client.get_intent(intent_id)
client.patch_state(intent_id, {"key": "value"})
except NotFoundError:
# Intent doesn't exist
print("Intent not found")