Skip to content

Exceptions ​

pythonpython
from rillkit import RillkitError, PublishError, DecodeError, AckMessage, NackMessage, RejectMessage

All inherit from RillkitError, which inherits from Exception.

ExceptionRaised byMeaning
RillkitErrorBase class for every RillKit error.
PublishErrorbroker.publish and publishersThe message could not be written to the stream (Redis error, or a body the codec could not encode). The underlying error is available as __cause__.
DecodeErrorcodecs, Message.body, pydantic validationThe body could not be decoded or validated. Never retried: the message goes straight to the DLQ.
AckMessageyou, in a handler or middlewareStops processing and acknowledges the message.
RejectMessageyou, in a handler or middlewareStops processing and sends the message to the DLQ immediately, skipping retries. The text becomes x-error.
NackMessageyou, in a handler or middlewareStops processing and nacks the message so it is retried (or dead-lettered once retries run out).

AckMessage, NackMessage and RejectMessage are control flow, not errors. Pass text (NackMessage("rate limited")) so the DLQ x-error field says why; with no text it falls back to the exception class name.

Any other exception from a handler counts as a failure and is handled according to the ack policy.

RillKit is released under the MIT License.