misc.py 578 B

1234567891011121314151617
  1. # SPDX-FileCopyrightText: 2026 geisserml <geisserml@gmail.com>
  2. # SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
  3. __all__ = ("PdfiumError", )
  4. class PdfiumError (RuntimeError):
  5. """
  6. An exception from the PDFium library, detected by function return code.
  7. Attributes:
  8. err_code (int | None): PDFium error code, for programmatic handling of error subtypes, if provided by the API in question (e.g. document loading). None otherwise.
  9. """
  10. def __init__(self, msg, err_code=None):
  11. super().__init__(msg)
  12. self.err_code = err_code