Skip to content

Exceptions

The exception hierarchy. Every fastsqs error derives from FastSQSError; SkipMessage deliberately does not — it is a control-flow ack signal, not an error, so a blanket except FastSQSError can never swallow it.

FastSQSError

Bases: Exception

Base class for all FastSQS errors.

RouteNotFoundError

Bases: FastSQSError

Raised when no route handler matches a message and no default handler is set.

InvalidMessageError

Bases: FastSQSError

Raised when a message body has an invalid format or content.

BatchFailedError

Bases: FastSQSError

Raised when partial_batch_failure is False and at least one record failed: the whole batch is failed (the Lambda invocation raises) so SQS redelivers every message, instead of silently reporting no failures.

The failed item identifiers are available on :attr:failures.

IdempotencyInProgressError

Bases: FastSQSError

Raised for a duplicate whose first copy is still in flight.

Failing the record (instead of skipping) makes SQS redeliver it after the visibility timeout — by then the in-flight attempt has completed (the redelivery skips) or failed/expired (the redelivery processes). Skipping would lose the message if the in-flight attempt fails.

SkipMessage

Bases: Exception

Control-flow signal: ack the current record as SUCCESS without (further) processing.

Raise from a middleware before or from a handler to mark the record done on purpose — e.g. an idempotency middleware seeing an already-completed duplicate. The record is NOT reported as a batch item failure, so SQS deletes it instead of redelivering.

Deliberately NOT a :class:FastSQSError: it is not an error, and a user's blanket except FastSQSError error handling must never swallow an ack.