Source code for sarkas.utilities.exceptions

"""Module of Exceptions and warnings specific to Sarkas."""

# __all__ = [
#     "SarkasError",
#     "ParticlesError",
#     "SarkasWarning",
#     "PhysicsWarning",
#     "AlgorithmWarning",
# ]

# ------------------------------------------------------------------------------
#   Exceptions
# ------------------------------------------------------------------------------


[docs]class SarkasError(Exception): """ Base class of Sarkas custom errors. All custom exceptions raised by Sarkas should inherit from this class and be defined in this module. """
[docs]class TimerError(Exception): """A custom exception used to report errors in use of Timer class"""
# ^^^^^^^^^^^^ Base Exceptions should be defined above this comment ^^^^^^^^^^^^
[docs]class AlgorithmError(SarkasError): """The base error for errors related to the chosen algorithm."""
[docs]class ParticlesError(SarkasError): """The base error for errors related to the Particles class."""
# ------------------------------------------------------------------------------ # Warnings # ------------------------------------------------------------------------------
[docs]class SarkasWarning(Warning): """ Base class of Sarkas custom warnings. All Sarkas custom warnings should inherit from this class and be defined in this module. Warnings should be issued using `warnings.warn`, which will not break execution if unhandled. """ pass
[docs]class PhysicsWarning(Warning): """The base warning for warnings related to non-physical situations."""
# ^^^^^^^^^^^^^ Base Warnings should be defined above this comment ^^^^^^^^^^^^^
[docs]class AlgorithmWarning(SarkasWarning): """The base warning for warnings related to the used algorithm."""
[docs]class ParticlesWarning(SarkasWarning): """The base warning for warnings related to the Particles class."""