Coverage for src/pdfbaker/errors.py: 100%
13 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-20 04:55 +1200
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-20 04:55 +1200
1"""pdfbaker exceptions."""
3from pathlib import Path
5__all__ = [
6 "ConfigurationError",
7 "PDFBakerError",
8 "PDFCombineError",
9 "PDFCompressionError",
10 "SVGConversionError",
11 "SVGTemplateError",
12]
15class PDFBakerError(Exception):
16 """Base exception for PDF baking errors."""
19class ConfigurationError(PDFBakerError):
20 """Failed to load or parse configuration."""
23class PDFCombineError(PDFBakerError):
24 """Failed to combine PDFs."""
27class PDFCompressionError(PDFBakerError):
28 """Failed to compress PDF."""
31class SVGConversionError(PDFBakerError):
32 """Failed to convert SVG to PDF."""
34 def __init__(
35 self, svg_path: str | Path, backend: str, cause: str | None = None
36 ) -> None:
37 self.svg_path = svg_path
38 self.backend = backend
39 self.cause = cause
40 super().__init__(f"Failed to convert {svg_path} using {backend}: {cause}")
43class SVGTemplateError(PDFBakerError):
44 """Failed to load or render an SVG template."""