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

Fix uncaught C++ exception in runAmiciSimulation #2338

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/amici.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,20 @@
);
}

rdata->processSimulationObjects(
preeq.get(), fwd.get(), bwd_success ? bwd.get() : nullptr, posteq.get(),
model, solver, edata
);
try {
rdata->processSimulationObjects(
preeq.get(), fwd.get(), bwd_success ? bwd.get() : nullptr, posteq.get(),
model, solver, edata
);
} catch (std::exception const& ex) {
rdata->status = AMICI_ERROR;

Check warning on line 229 in src/amici.cpp

View check run for this annotation

Codecov / codecov/patch

src/amici.cpp#L228-L229

Added lines #L228 - L229 were not covered by tests
if (rethrow)
throw;
logger.log(

Check warning on line 232 in src/amici.cpp

View check run for this annotation

Codecov / codecov/patch

src/amici.cpp#L231-L232

Added lines #L231 - L232 were not covered by tests
LogSeverity::error, "OTHER", "AMICI simulation failed: %s",
ex.what()

Check warning on line 234 in src/amici.cpp

View check run for this annotation

Codecov / codecov/patch

src/amici.cpp#L234

Added line #L234 was not covered by tests
);
}

rdata->cpu_time_total = cpu_timer.elapsed_milliseconds();

Expand Down
Loading