Source code for plasmapy.particles.exceptions

"""Collection of exceptions and warnings for `plasmapy.particles`."""

__all__ = [
    "ParticleError",
    "ParticleWarning",
    "ChargeError",
    "InvalidElementError",
    "InvalidIonError",
    "InvalidIsotopeError",
    "InvalidParticleError",
    "MissingParticleDataError",
    "MissingParticleDataWarning",
    "UnexpectedParticleError",
]

from plasmapy.utils.exceptions import PlasmaPyError, PlasmaPyWarning


[docs] class ParticleError(PlasmaPyError): """Base exception for errors in the `~plasmapy.particles` subpackage."""
[docs] class MissingParticleDataError(ParticleError): """ An exception for missing atomic or particle data in the `~plasmapy.particles` subpackage. """
[docs] class ChargeError(ParticleError): """An exception for incorrect or missing charge information."""
[docs] class UnexpectedParticleError(ParticleError): """An exception for when a particle is not of the expected category."""
[docs] class InvalidIonError(UnexpectedParticleError): """ An exception for when an argument is a valid particle but not a valid ion. """
[docs] class InvalidIsotopeError(UnexpectedParticleError): """ An exception for when an argument is a valid particle but not a valid isotope. """
[docs] class InvalidElementError(UnexpectedParticleError): """ An exception for when an argument is a valid particle is not a valid element. """
[docs] class InvalidParticleError(ParticleError): """An exception for when a particle is invalid."""
[docs] class ParticleWarning(PlasmaPyWarning): """The base warning for the `~plasmapy.particles` subpackage."""
[docs] class MissingParticleDataWarning(ParticleWarning): """Warning for use when atomic or particle data is missing."""