Errors

Every error is a MirexaError; the module docstring of mirexa.errors explains the families.

exception mirexa.MirexaError

Bases: Exception

Base of every error this package raises.

exception mirexa.RemoteError(code: int, message: str, retry_after_ms: int = 0)

Bases: MirexaError

The server refused a request with an ERROR frame.

property retryable: bool

Only Overloaded is retryable: it is raised before anything is stored, so a re-send is a first attempt. StalePlacement carries a retry hint too, but is not retryable on the same connection.

class mirexa.ErrorCode(*values)

ERROR frame codes (the protocol’s v1 vocabulary).

exception mirexa.OverloadedError(code: int, message: str, retry_after_ms: int = 0)

Bases: RemoteError

The server shed the request before storing anything.

exception mirexa.UnauthorizedError(code: int, message: str, retry_after_ms: int = 0)

Bases: RemoteError

The token was refused, or does not grant what the request needs.

exception mirexa.SlowConsumerError(code: int, message: str, retry_after_ms: int = 0)

Bases: RemoteError

A subscription was evicted for not reading fast enough.

exception mirexa.PartitionUnavailableError(code: int, message: str, retry_after_ms: int = 0)

Bases: RemoteError

No node can currently serve the stream’s partition.

exception mirexa.RetriesExhaustedError

Bases: MirexaError

Every attempt was shed (Overloaded). __cause__ is the last one.

exception mirexa.TransportError

Bases: MirexaError

The connection failed: refused, reset, closed or timed out.

exception mirexa.AmbiguousWriteError

Bases: TransportError

The connection failed with a write in flight; its outcome is unknown.

The batch may have been applied with only the acknowledgement lost. Reconcile by querying the range back. Re-sending a CANDLE batch is also safe: a bar the node already holds is restated and an identical one skipped. It is not done for you, because a re-send overwrites any bar someone else restated in between, and a trade batch has no such key — two trades may share a timestamp, so a re-send can store one twice.

exception mirexa.ClientClosedError

Bases: TransportError

The client, or its connection, is closed.

exception mirexa.RequestTimeoutError

Bases: TransportError

No response arrived within the request timeout.

exception mirexa.QueryStatusError(status: int, stream: object)

Bases: MirexaError

A query answered with a non-OK status.

exception mirexa.StreamNotFoundError(status: int, stream: object)

Bases: QueryStatusError

The node has no such stream.

exception mirexa.RedirectError(partition: int, epoch: int, node_id: int, addr: str)

Bases: MirexaError

Another node serves this stream. This client does not route (yet).

exception mirexa.DerivedStreamError(code: int, message: str, retry_after_ms: int = 0)

Bases: RemoteError

A write to a DERIVED stream without overwrite=True. The node writes that stream itself from its source; nothing was stored. Re-send with overwrite=True only if replacing derived bars is what you mean.

exception mirexa.WireFormatError

Bases: MirexaError

A payload that does not decode (the server’s ErrPayloadFormat).