The error every chat operation fails with (Effect's effect/chat/ChatError).
A ChatError records the platform and op and holds one of twelve reasons.
Each reason has a three-way retry value: "retry" means nothing
happened and the request is safe to send again, "uncertain" means a
write may or may not have landed, and "denied" means sending again gives
the same answer.
detailis redacted: a platform code such aschannel_not_found, never message text, file names or ids.file_refusedis fixed by the core: on a"denied"reason it promises a file was refused and nothing is left posted.causeis the error underneath (an HTTP error, aSchemaError). It is unredacted, somessage,str()andto_json()leave it out; the schema keeps it.
Handle one reason with catch_reason(ChatError, NotFound, handler).
Values#
| Attribute | Type | Description |
|---|---|---|
RETRY | LiteralsSchema[Literal['retry', 'uncertain', 'denied']] | |
CAPABILITIES | tuple[Capability, ...] | Every capability, in Effect's order (Effect's |
CAPABILITY | LiteralsSchema[Literal['edit', 'delete', 'fetchMessage', 'history', 'download', 'files', 'replyTo', 'startThread', 'getThread', 'opener', 'getUser', 'nativeStream', 'buttons', 'selects', 'modals', 'modalErrors', 'commands', 'ephemeral']] | |
FILE_REFUSED | Literal['file_refused'] = 'file_refused' | Detail for a refused file on any |
INTERACTION_EXPIRED | Literal['interaction_expired'] = 'interaction_expired' | Detail for a modal or follow-up past its deadline: the reason is
|
REASONS | tuple[type[ChatErrorReason], ...] | |
CHAT_ERROR_REASON | S.Bottom[AnyReason] | The schema of the twelve reasons (Effect's |
Types#
| Type | Definition | Description |
|---|---|---|
Retry | type Retry = Literal['retry', 'uncertain', 'denied'] | The retry value of a chat error. |
Capability | type Capability = Literal['edit', 'delete', 'fetchMessage', 'history', 'download', 'files', 'replyTo', 'startThread', 'getThread', 'opener', 'getUser', 'nativeStream', 'buttons', 'selects', 'modals', 'modalErrors', 'commands', 'ephemeral'] | A capability name from |
AnyReason | type AnyReason = RateLimited | Unsupported | Transport | PlatformUnavailable | NoAdapter | Unauthenticated | Forbidden | NotFound | TooLarge | InvalidRequest | InvalidResponse | Unknown | One of the twelve reasons a |
Classes#
Functions#
is_chat_error#
is_chat_error(u) -> bool| Parameter | Type | Description |
|---|---|---|
u | object |
Returns bool
def is_chat_error(u: object) -> bool:
return isinstance(u, ChatError)