Source code for bagofholding.exceptions

"""
A centralized location for exceptions.

Using custom exceptions allows us to be much more specific in the test suite.
"""

from __future__ import annotations


[docs] class BagOfHoldingError(Exception): """A base class for raising bagofholding-related exceptions"""
[docs] class BagMismatchError(BagOfHoldingError, ValueError): ...
[docs] class EnvironmentMismatchError(BagOfHoldingError, ModuleNotFoundError): ...
[docs] class FileAlreadyOpenError(BagOfHoldingError): ...
[docs] class FileNotOpenError(BagOfHoldingError): ...
[docs] class FilepathError(BagOfHoldingError, FileExistsError): ...
[docs] class InvalidMetadataError(BagOfHoldingError, ValueError): ...
[docs] class ModuleForbiddenError(BagOfHoldingError, ValueError): ...
[docs] class NotAGroupError(BagOfHoldingError, TypeError): ...
[docs] class NoVersionError(BagOfHoldingError, ValueError): ...
[docs] class PickleProtocolError(BagOfHoldingError, ValueError): ...
[docs] class StringNotImportableError(BagOfHoldingError): ...