Add reporting exception classes

This commit is contained in:
2026-01-29 17:56:29 +00:00
parent 5fdb1e6eaf
commit f7f2839e65

View File

@@ -0,0 +1,41 @@
"""Exception classes for the reporting module.
This module defines a hierarchy of exceptions for report generation errors,
enabling specific error handling for different failure modes.
"""
class ReportingError(Exception):
"""Base exception for all reporting-related errors."""
class ReportGenerationError(ReportingError):
"""Raised when report generation fails.
This is the general error for failures during the report generation
process that don't fit into more specific categories.
"""
class TemplateRenderError(ReportingError):
"""Raised when HTML template rendering fails.
This typically indicates a problem with the Jinja2 template or
the data being passed to it.
"""
class PDFConversionError(ReportingError):
"""Raised when HTML to PDF conversion fails.
This typically indicates a problem with WeasyPrint or the generated
HTML/CSS being incompatible with PDF rendering.
"""
class ChartGenerationError(ReportingError):
"""Raised when chart generation fails.
This typically indicates a problem with matplotlib or the measurement
data being charted.
"""