Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log traceback in case of exceptions during optimizations #1156

Merged
merged 8 commits into from
Oct 31, 2023
7 changes: 5 additions & 2 deletions pypesto/optimize/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,8 +1337,11 @@ def minimize(
try:
opt.minimize(x0)
msg = self._convert_exitflag_to_message(opt)
except RuntimeError as err:
msg = str(err)
except RuntimeError:
import sys
import traceback

msg = "\n".join(traceback.format_exception(*sys.exc_info()))

optimizer_result = OptimizerResult(
x=opt.x_min,
Expand Down