Exceptions

Custom exception hierarchy used by finamt.

finamt.exceptions

Exception hierarchy for the finamt library.

exception finamt.exceptions.FinanceAgentError(message: str, *, cause: BaseException | None = None)[source]

Bases: Exception

Base exception for all finamt errors.

exception finamt.exceptions.OCRProcessingError(message: str, *, cause: BaseException | None = None)[source]

Bases: FinanceAgentError

Raised when text cannot be extracted from an image or PDF.

exception finamt.exceptions.LLMExtractionError(message: str, *, cause: BaseException | None = None)[source]

Bases: FinanceAgentError

Raised when the local LLM fails to return valid structured JSON.

exception finamt.exceptions.InvalidReceiptError(message: str, *, cause: BaseException | None = None)[source]

Bases: FinanceAgentError

Raised when extracted receipt data fails business-logic validation.

exception finamt.exceptions.DuplicateReceiptError(message: str, *, existing_id: str)[source]

Bases: FinanceAgentError

Raised when a receipt with identical content already exists in the DB.

existing_id

The SHA-256 hash / DB id of the existing receipt.