From 266c2c9a072bf3289fd7f2d75278b7d59528378c Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Sat, 24 Dec 2022 10:27:09 +0100 Subject: 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" --- bsie/utils/errors.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 bsie/utils/errors.py (limited to 'bsie/utils/errors.py') 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 ## -- cgit v1.2.3 From 07219685d01f803dc46c8d5465fa542c1d822cb4 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Sat, 24 Dec 2022 10:39:51 +0100 Subject: documentation: standard vs external import --- bsie/utils/errors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bsie/utils/errors.py') diff --git a/bsie/utils/errors.py b/bsie/utils/errors.py index 5fafd5b..fbc16f7 100644 --- a/bsie/utils/errors.py +++ b/bsie/utils/errors.py @@ -4,7 +4,7 @@ Part of the bsie module. A copy of the license is provided with the project. Author: Matthias Baumgartner, 2022 """ -# imports +# standard imports import typing # exports -- cgit v1.2.3 From afd165000c1661a9cca117a4844ad3f89d926fdb Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Mon, 16 Jan 2023 20:53:39 +0100 Subject: unsupported file format exception --- bsie/utils/errors.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bsie/utils/errors.py') diff --git a/bsie/utils/errors.py b/bsie/utils/errors.py index fbc16f7..8133cd4 100644 --- a/bsie/utils/errors.py +++ b/bsie/utils/errors.py @@ -42,4 +42,7 @@ class UnreachableError(ProgrammingError): class ParserError(_BSIEError): """Failed to parse due to invalid syntax or structures.""" +class UnsupportedFileFormatError(ReaderError): + """Failed to read a file format.""" + ## EOF ## -- cgit v1.2.3 From 4b5c4d486bb4f0f4da2e25ad464e8336a781cdcb Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Wed, 1 Mar 2023 22:31:03 +0100 Subject: removed module header stubs --- bsie/utils/errors.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'bsie/utils/errors.py') diff --git a/bsie/utils/errors.py b/bsie/utils/errors.py index 8133cd4..e71fc60 100644 --- a/bsie/utils/errors.py +++ b/bsie/utils/errors.py @@ -1,8 +1,4 @@ """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 -- cgit v1.2.3 From 70d77819a84c73292825b81f952e162bb30753d7 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Thu, 2 Mar 2023 08:56:57 +0100 Subject: reader error: untangle generic from unsupported format errors --- bsie/utils/errors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bsie/utils/errors.py') diff --git a/bsie/utils/errors.py b/bsie/utils/errors.py index e71fc60..7c7e6ed 100644 --- a/bsie/utils/errors.py +++ b/bsie/utils/errors.py @@ -38,7 +38,7 @@ class UnreachableError(ProgrammingError): class ParserError(_BSIEError): """Failed to parse due to invalid syntax or structures.""" -class UnsupportedFileFormatError(ReaderError): +class UnsupportedFileFormatError(_BSIEError): """Failed to read a file format.""" ## EOF ## -- cgit v1.2.3