From be5a3c6109b000689817dc816054e4a0142d984a Mon Sep 17 00:00:00 2001 From: Siddharth Mishra-Sharma Date: Fri, 23 Jan 2026 21:30:31 -0500 Subject: [PATCH] Fix: raise TypeError instead of return TypeError BUG: Line 161 used `return TypeError(...)` instead of `raise TypeError(...)`. This meant that when a Reaction was created without either spline_data or frwrd_rate_param_func, the __init__ method would: 1. Return a TypeError instance (which is truthy, not an error) 2. Allow object construction to "succeed" 3. Cause cryptic failures later when the object is used The fix changes `return` to `raise` so invalid Reaction construction properly fails with a clear error message. Co-Authored-By: Claude Opus 4.5 --- linx/reactions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linx/reactions.py b/linx/reactions.py index ce2102e..e5e14cf 100644 --- a/linx/reactions.py +++ b/linx/reactions.py @@ -156,10 +156,10 @@ def __init__( self.frwrd_rate_param_func = frwrd_rate_param_func - else: + else: - return TypeError('Must include spline data points or analytic \ - function for rates.') + raise TypeError('Must include spline data points or analytic ' + 'function for rates.') @eqx.filter_jit def frwrd_rate_param(self, T, p):