Skip to content

Exceptions API

FailedBuildClient

Bases: Exception

Raised when the automation client cannot be initialized.

FailedToDecodeProto

Bases: Exception

Raised when protobuf payload decoding fails.

EventDispatchError

Bases: Exception

Raised when event callback dispatching fails.

PyPayloadBuildError

Bases: Exception

Raised when Python payload conversion into Rust structures fails.

UnsupportedBackend

Bases: Exception

Raised when a backend object is not supported by the current runtime.

UnsupportedEventType

Bases: Exception

Raised when registering or dispatching an unknown event class.


Exception hierarchy for Tryx error handling.

Exception Hierarchy

Exception
├── FailedBuildClient     — Client initialization failure
│   ├── BuildBotError     — (legacy alias)
│   └── FailedBuildBot    — (legacy alias)
├── FailedToDecodeProto   — Protobuf decoding failure
├── EventDispatchError    — Event callback dispatch failure
├── PyPayloadBuildError   — Python-to-Rust payload conversion failure
├── UnsupportedBackend    — Incompatible storage backend
│   └── UnsupportedBackendError — (legacy alias)
└── UnsupportedEventType  — Unknown event class registration
    └── UnsupportedEventTypeError — (legacy alias)

Usage Examples

Client Initialization

from tryx.exceptions import FailedBuildClient

try:
    app = Tryx(backend)
except FailedBuildClient as e:
    print(f"Failed to initialize client: {e}")

Event Handling

from tryx.exceptions import EventDispatchError


@app.on(EvMessage)
async def on_message(client, event):
    try:
        # process event
        pass
    except EventDispatchError as e:
        print(f"Dispatch failed: {e}")

Backend Errors

from tryx.exceptions import UnsupportedBackend

if not isinstance(backend, (SqliteStore, FfiStoreProtocol, StoreBase)):
    raise UnsupportedBackend(f"Unsupported backend type: {type(backend)}")

Backward Compatibility

Legacy exception names are available as aliases:

Legacy Name Modern Name
BuildBotError FailedBuildClient
FailedBuildBot FailedBuildClient
UnsupportedEventTypeError UnsupportedEventType
UnsupportedBackendError UnsupportedBackend

Migration

If you're using legacy exception names, update to the modern names. Legacy aliases will be removed in a future major version.