Exceptions and Warnings#

RocketPy raises a small hierarchy of custom exceptions and warnings so that error handling can be more specific than catching plain ValueError or UserWarning. All exceptions inherit from RocketPyError, which makes it possible to catch any RocketPy-specific error with a single except clause while still deriving from the relevant built-in type (e.g. InvalidParameterError is also a ValueError).

Custom exceptions and warnings for RocketPy.

exception rocketpy.exceptions.RocketPyError[source]#

Bases: Exception

Base class for all RocketPy exceptions.

exception rocketpy.exceptions.InvalidParameterError[source]#

Bases: RocketPyError, ValueError

Raised when a constructor parameter has an invalid value (e.g. negative radius or mass).

exception rocketpy.exceptions.InvalidInertiaError[source]#

Bases: RocketPyError, ValueError

Raised when the inertia tuple/list does not have the expected length.

exception rocketpy.exceptions.UnstableRocketWarning[source]#

Bases: UserWarning

Issued when the rocket’s static margin is negative at motor ignition, indicating an aerodynamically unstable configuration.

Not issued when the rocket has any GenericSurface aerodynamic surfaces, since their lift coefficient derivative is not accounted for in the center of pressure calculation, making the static margin unreliable for this check in that case.