Skip to content

Commit

Permalink
[Kinetics] Always fail fast on invalid reactions in debug mode
Browse files Browse the repository at this point in the history
This extends the behavior of failing fast on invalid reactions when in
debug mode to the case where the reactions are in a different file from
the phase definition.
  • Loading branch information
speth committed Aug 7, 2022
1 parent 0c991fa commit 919d990
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/kinetics/KineticsFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ void addReactions(Kinetics& kin, const AnyMap& phaseNode, const AnyMap& rootNode
AnyMap reactions = AnyMap::fromYamlFile(fileName,
rootNode.getString("__file__", ""));
for (const auto& R : reactions[node].asVector<AnyMap>()) {
try {
#ifdef NDEBUG
try {
kin.addReaction(newReaction(R, kin), false);
} catch (CanteraError& err) {
fmt_append(add_rxn_err, "{}", err.what());
}
#else
kin.addReaction(newReaction(R, kin), false);
} catch (CanteraError& err) {
fmt_append(add_rxn_err, "{}", err.what());
}
#endif
}
} else {
// specified section is in the current file
Expand Down

0 comments on commit 919d990

Please sign in to comment.