Skip to content

Commit 953f796

Browse files
committed
MNT: replaced the broad except Exception: with except (TypeError, ValueError, OverflowError): in get_drag_coefficient of flight.py
1 parent 84350e6 commit 953f796

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

rocketpy/simulation/flight.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,10 @@ def __get_drag_coefficient(self, drag_function, mach, z, freestream_velocity_bod
14151415
# Use a small epsilon fallback if `mu` is zero, negative, NaN or infinite.
14161416
try:
14171417
mu_val = float(mu)
1418-
except Exception:
1418+
except (TypeError, ValueError, OverflowError):
1419+
# Only catch errors related to invalid numeric conversion.
1420+
# Avoid catching broad Exception to satisfy linters and
1421+
# allow other unexpected errors to surface.
14191422
mu_val = 0.0
14201423
if not np.isfinite(mu_val) or mu_val <= 0.0:
14211424
mu_safe = 1e-10

0 commit comments

Comments
 (0)