Skip to content

Commit

Permalink
ENH: raises an error when user 'export_function' contains errors from…
Browse files Browse the repository at this point in the history
… any kind (attribute, logical, etc)
  • Loading branch information
Lucas-Prates committed Nov 11, 2024
1 parent d411a22 commit a298685
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rocketpy/simulation/monte_carlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,14 @@ def __export_flight_data(
}

if self.export_function is not None:
additional_exports = self.export_function(flight)
try:
additional_exports = self.export_function(flight)
except Exception as e:
raise ValueError(
"An error was encountered running your custom export function. "
"Check for errors in 'export_function' definition."
) from e

for key in additional_exports.keys():
if key in self.export_list:
raise ValueError(
Expand Down

0 comments on commit a298685

Please sign in to comment.