Coverage for src/qdrant_loader/core/chunking/docling/exceptions.py: 62%
8 statements
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-20 10:15 +0000
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-20 10:15 +0000
1"""Errors the chunking layer raises — loud by design.
3The legacy markdown chunker degrades *silently*: a shape mismatch falls through to
4a fallback splitter or returns one giant chunk with no signal.
5This layer rejects that — when an invariant the contract depends on breaks, it
6raises. These are the cases the chunker refuses to paper over.
7"""
9from __future__ import annotations
12class ChunkingError(Exception):
13 """Base class for chunking errors raised by this package."""
16class EmptyDocumentError(ChunkingError):
17 """The source produced no chunkable content — never emit a fake empty chunk."""
20class TokenizerUnavailableError(ChunkingError):
21 """The configured tokenizer kind cannot be constructed for chunk sizing."""
23 def __init__(self, kind: str, reason: str) -> None:
24 super().__init__(f"cannot build {kind!r} tokenizer: {reason}")
25 self.kind = kind
26 self.reason = reason