Skip to content

xtr_cache.exception

Every error this library raises, all deriving from the contract's :class:CacheError.

:class:CacheError and :class:InvalidArgumentError are the contract's own, re-exported so a caller catching them from here catches exactly what a library written against xtr-cache-contracts catches.

LogicError

LogicError(reason: str)

Bases: CacheError

An operation was asked of an object that cannot perform it.

Tagging an item that comes from a pool which cannot store tags, say. A mistake in the calling code, never a backend failing.

Attributes:

  • reason (str) –

    What was asked, and why it cannot be done.

Record what was asked, and why it cannot be done.

MarshallingError

MarshallingError(reason: str)

Bases: CacheError

A stored value could not be turned back into what was cached.

Raised by a marshaller's unmarshall for bytes that are corrupt, were written by something else, or fail their integrity check. A pool reading such a value logs it and reports a miss, so the caller computes the value again rather than failing.

Attributes:

  • reason (str) –

    Why the value could not be read.

Record why the value could not be read.