GitHub

ChatMarkdownError

API reference for ChatMarkdownError.

class ChatMarkdownError[E = Never]

A call that did not deliver its whole input.

  • posted is text the platform confirmed, uncertain text sent in a write that failed "uncertain" and was never confirmed since, remaining text never sent: posted, then uncertain, then remaining is the input.
  • remaining_fence is the line that opened the code fence remaining starts in, when it does: text sent later starts with it and a newline.
  • cause is a write's ChatError, the deltas' error, or OverflowCause.

It carries message text, so message, str() and to_json leave the text out.

Attributes

AttributeTypeDescription
postedtuple[Part, ...]
remainingstr
causeCause[E]
remaining_fencestr | None = None
uncertainstr | None = None
messagestr

Functions

__init__

__init__(posted, remaining, cause, remaining_fence=None, uncertain=None) -> None
ParameterTypeDescription
postedtuple[Part, ...]
remainingstr
causeCause[E]
remaining_fencestr | None = None
uncertainstr | None = None

to_json

to_json() -> object

The error without its message text.

Returns object

def to_json(self) -> object:
    """The error without its message text."""
    cause = self.cause
    return {
        "_tag": "ChatMarkdownError",
        "posted": [
            {"messageId": p.message_id, "kind": p.kind, "transport": p.transport}
            for p in self.posted
        ],
        "cause": {"_tag": "Chat", "error": cause.error.to_json()}
        if isinstance(cause, ChatCause)
        else {"_tag": cause._tag},  # pyright: ignore[reportPrivateUsage]
    }