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

Make PodioOutput exit gracefully instead of crashing #159

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Changes from 2 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
20 changes: 19 additions & 1 deletion k4FWCore/components/PodioOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,25 @@ StatusCode PodioOutput::execute() {
}
m_framewriter->writeFrame(frame, "events", m_collection_names_to_write);
} else {
m_framewriter->writeFrame(frame, "events", m_collection_names_to_write);
try {
m_framewriter->writeFrame(frame, "events", m_collection_names_to_write);
} catch (std::runtime_error&) {
// In this error message we are only interested in the ones that are
// missing, since only a missing collection can trigger the exception
// here. Additional collections that are present in the Frame are not
// necessarily an issue here, because we might just be configured to not
// write all of them
const auto& [missing, _] = m_framewriter->checkConsistency(frame.getAvailableCollections(), "events");
error() << "Could not write event, because the following collections are not present: ";
std::string sep = "";
for (const auto& n : missing) {
error() << sep << n;
jmcarcell marked this conversation as resolved.
Show resolved Hide resolved
sep = ", ";
}
error() << endmsg;

return StatusCode::FAILURE;
}
}
m_firstEvent = false;

Expand Down
Loading