diff options
author | Matthias Baumgartner <dev@igsor.net> | 2022-12-24 10:27:09 +0100 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2022-12-24 10:27:09 +0100 |
commit | 266c2c9a072bf3289fd7f2d75278b7d59528378c (patch) | |
tree | 60760e0fec84d5cd7b3f3efef11e3892df5cc85a /bsie/utils/errors.py | |
parent | ed2074ae88f2db6cb6b38716b43b35e29eb2e16c (diff) | |
download | bsie-266c2c9a072bf3289fd7f2d75278b7d59528378c.tar.gz bsie-266c2c9a072bf3289fd7f2d75278b7d59528378c.tar.bz2 bsie-266c2c9a072bf3289fd7f2d75278b7d59528378c.zip |
package restructuring: base
* Reader and Extractor to respective reader/extractor modules
* ReaderBuilder to reader module
* ExtractorBuilder to extractor module
* Loading module in utils (safe_load, unpack_name)
* Pipeline and PipelineBuilder to lib module
* errors to utils
* documentation: "standard import" and "external import"
Diffstat (limited to 'bsie/utils/errors.py')
-rw-r--r-- | bsie/utils/errors.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/bsie/utils/errors.py b/bsie/utils/errors.py new file mode 100644 index 0000000..5fafd5b --- /dev/null +++ b/bsie/utils/errors.py @@ -0,0 +1,45 @@ +"""Common BSIE exceptions. + +Part of the bsie module. +A copy of the license is provided with the project. +Author: Matthias Baumgartner, 2022 +""" +# 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.""" + +## EOF ## |