Exception Reference
The exception hierarchy defined in natural_pdf/exceptions.py, introspected from the module. Indentation shows inheritance.
NaturalPDFError(Exception)— Base exception for all Natural PDF errors.ClassificationError— Error during classification operations.ConfigurationError— Error in configuration or options.InvalidOptionError— Raised when an option value is invalid (wrong type, out of range, etc.).
ContentFilterError— Raised when a content filter cannot be compiled or evaluated safely.ExclusionError— Raised when an exclusion rule cannot be evaluated safely.ExportError— Error during export operations.LayoutError— Error during layout detection.LayoutEngineNotAvailableError— Raised when a requested layout engine is not installed or available.
OCRError— Error during OCR processing.OCREngineNotAvailableError— Raised when a requested OCR engine is not installed or available.
QAError— Error during document Q&A operations.SearchError— Error during search operations.SelectorError— Error in selector parsing or matching.SelectorMatchError— Raised when selector matching encounters an error.SelectorParseError— Raised when a selector string cannot be parsed.
TextExtractionError— Raised when text acquisition or layout reconstruction fails.
Catch NaturalPDFError to handle every library-raised error with one handler:
from natural_pdf.exceptions import NaturalPDFError
try: pdf.apply_ocr()except NaturalPDFError as e: handle_error(e)