Skip to content

ENH: Add custom exceptions and unstable rocket warning (#285)#970

Open
Matanski wants to merge 1 commit into
RocketPy-Team:masterfrom
Matanski:ENH/custom-exceptions-285
Open

ENH: Add custom exceptions and unstable rocket warning (#285)#970
Matanski wants to merge 1 commit into
RocketPy-Team:masterfrom
Matanski:ENH/custom-exceptions-285

Conversation

@Matanski

Copy link
Copy Markdown

Closes #285

Changes

  • Added rocketpy/exceptions.py with three new types:
    • InvalidParameterError – raised when Rocket is constructed with non-positive radius or mass
    • InvalidInertiaError – raised when the inertia tuple has wrong length (not 3 or 6)
    • UnstableRocketWarning – issued automatically when static margin is negative at motor ignition
  • Added input validation in Rocket.__init__
  • Added stability check in evaluate_static_margin
  • Exported all three names from the top-level rocketpy package

Testing

All existing unit tests pass (106 rocket + 70 motor tests).

…#285)

Introduces a dedicated `rocketpy/exceptions.py` module with three new
types: `InvalidParameterError` (bad radius/mass values), `InvalidInertiaError`
(wrong inertia tuple length), and `UnstableRocketWarning` (negative static
margin at ignition). Validation is applied in `Rocket.__init__` and a warning
is issued automatically after `evaluate_static_margin` when the rocket is
aerodynamically unstable. All three new names are exported from the top-level
`rocketpy` package.

Closes RocketPy-Team#285
@Matanski Matanski requested a review from a team as a code owner June 16, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: Custom Exception errors and messages

1 participant