Skip to content

[FEATURE] implement custom exceptions 157 #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion multicast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@
# skipcq
__all__ = [
"""__package__""", """__module__""", """__name__""", """__version__""", """__prologue__""",
"""__doc__""", """skt""", """skt.__package__""", """skt.__module__""", """skt.__name__""",
"""__doc__""", """exceptions""", """exceptions.CommandExecutionError""",
"""exceptions.get_exit_code_from_exception""", """exceptions.exit_on_exception""",
"""get_exit_code_from_exception""", """exit_on_exception""",
"""skt""", """skt.__package__""", """skt.__module__""", """skt.__name__""",
"""skt.__file__""", """skt.genSocket""", """skt.genSocket.__func__""", """genSocket""",
"""skt.endSocket""", """skt.endSocket.__func__""", """endSocket""",
"""EXIT_CODES""", """EXCEPTION_EXIT_CODES""",
"""_BLANK""", """_MCAST_DEFAULT_PORT""", """_MCAST_DEFAULT_GROUP""",
"""_MCAST_DEFAULT_TTL""", """mtool""", """recv""", """send""", """hear""",
"""recv.McastRECV""", """send.McastSAY""", """hear.McastHEAR""",
Expand Down Expand Up @@ -352,6 +356,23 @@
raise ModuleNotFoundError("FAIL: we could not import Abstract base class. ABORT.") from None


if 'multicast.exceptions' not in sys.modules:
# pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
from . import exceptions # pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
else: # pragma: no branch
exceptions = sys.modules["""multicast.exceptions"""]

EXIT_CODES = exceptions.EXIT_CODES

EXCEPTION_EXIT_CODES = exceptions.EXCEPTION_EXIT_CODES

CommandExecutionError = exceptions.CommandExecutionError

get_exit_code_from_exception = exceptions.get_exit_code_from_exception

exit_on_exception = exceptions.exit_on_exception


class mtool(abc.ABC):
"""
Class for Multicast tools.
Expand Down Expand Up @@ -602,9 +623,11 @@ def doStep(self, *args): # pragma: no cover


genSocket = skt.genSocket
"""See multicast.skt.genSocket."""


endSocket = skt.endSocket
"""See multicast.skt.endSocket."""


if 'multicast.recv' not in sys.modules:
Expand Down
Loading
Loading