cadrumo.application.corpus_search.errors module

Typed errors for the on-host corpus-search grounding surface.

These are registered CadrumoError subclasses, so a corpus-search failure that reaches the CLI boundary renders as its proper category envelope (a REFUSED input/dependency refusal, an ERROR base) rather than collapsing into the generic INTERNAL unexpected-boundary path. Each class binds one registered ErrorCode (declared in core.errors.registry._application_part1) whose message_key supplies the localized envelope message, and the specifics ride on context — the same contextual detail an external adapter may project onto an envelope (the offending query/limit/ref). The condition itself travels as a reason discriminant rather than as a sentence: a free-form constructor message would be preferred by str(exc) over the registered key, so it would reach tracebacks, logs and every direct rendering of the exception in English regardless of locale.

There is no dependency refusal here: the retrieval surface needs no optional package, so it can never refuse for want of one.

exception CorpusSearchError(*, reason, translated_message='errors.error.error_corpus_search', context=None)[source]

Bases: CadrumoError

Base error for the corpus-search grounding surface.

Parameters:
  • reason (str)

  • translated_message (str)

  • context (Mapping[str, object] | None)

Return type:

None

code
exception CorpusSearchInputError(*, reason, context=None)[source]

Bases: CorpusSearchError

Raised when a corpus-search request cannot be satisfied.

Covers an unknown citation id, a corpus_ref whose backing extracted text is missing, an empty query, and any other caller-supplied input the surface refuses. Which of those it is travels as reason.

Parameters:
Return type:

None

code