Skip to content

Commit fa0f466

Browse files
damienbarkerjenkins
authored andcommitted
QPR-12319 -- Improve error message when underlying bond basket build fails due...
1 parent 9b9def8 commit fa0f466

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

OREData/ored/portfolio/bondposition.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ void BondPosition::build(const boost::shared_ptr<ore::data::EngineFactory>& engi
7474

7575
maturity_ = Date::minDate();
7676
for (auto const& u : data_.underlyings()) {
77-
bonds_.push_back(BondFactory::instance().build(engineFactory, engineFactory->referenceData(), u.name()));
77+
try {
78+
bonds_.push_back(BondFactory::instance().build(engineFactory, engineFactory->referenceData(), u.name()));
79+
} catch (const std::exception& e) {
80+
QL_FAIL("Build failed for underlying " << u.type() << " (" << u.name() << "): " << e.what());
81+
}
7882
weights_.push_back(u.weight());
7983
bidAskAdjustments_.push_back(u.bidAskAdjustment());
8084
maturity_ = std::max(bonds_.back().bond->maturityDate(), maturity_);

0 commit comments

Comments
 (0)