diff options
Diffstat (limited to 'bsie/utils/errors.py')
-rw-r--r-- | bsie/utils/errors.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/bsie/utils/errors.py b/bsie/utils/errors.py new file mode 100644 index 0000000..8133cd4 --- /dev/null +++ b/bsie/utils/errors.py @@ -0,0 +1,48 @@ +"""Common BSIE exceptions. + +Part of the bsie module. +A copy of the license is provided with the project. +Author: Matthias Baumgartner, 2022 +""" +# standard imports +import typing + +# exports +__all__: typing.Sequence[str] = ( + 'BuilderError', + 'ExtractorError', + 'LoaderError', + 'ReaderError', + ) + + +## code ## + +class _BSIEError(Exception): + """Generic BSIE error.""" + +class BuilderError(_BSIEError): + """The Builder failed to create an instance.""" + +class LoaderError(BuilderError): + """Failed to load a module or class.""" + +class ExtractorError(_BSIEError): + """The Extractor failed to process the given content.""" + +class ReaderError(_BSIEError): + """The Reader failed to read the given file.""" + +class ProgrammingError(_BSIEError): + """An assertion-like error that indicates a code-base issue.""" + +class UnreachableError(ProgrammingError): + """Bravo, you've reached a point in code that should logically not be reachable.""" + +class ParserError(_BSIEError): + """Failed to parse due to invalid syntax or structures.""" + +class UnsupportedFileFormatError(ReaderError): + """Failed to read a file format.""" + +## EOF ## |