Skip to content

Commit 8791a5b

Browse files
pcaspersjenkins
authored andcommitted
QPR-12281 log inconsistencies between sim market keys and sensi keys instead of terminating
1 parent 647e98c commit 8791a5b

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

OREAnalytics/orea/engine/historicalsensipnlcalculator.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
1717
*/
1818

19-
#include <orea/engine/historicalsensipnlcalculator.hpp>
19+
#include <orea/app/structuredanalyticserror.hpp>
2020
#include <orea/cube/inmemorycube.hpp>
21+
#include <orea/engine/historicalsensipnlcalculator.hpp>
2122
#include <ored/utilities/to_string.hpp>
2223

2324
#include <boost/accumulators/statistics/tail_quantile.hpp>
@@ -173,8 +174,16 @@ void HistoricalSensiPnlCalculator::populateSensiShifts(boost::shared_ptr<NPVCube
173174

174175
Size j = 0;
175176
for (const auto& [_, key] : keyNameMapping) {
176-
Real shift = shiftCalculator->shift(key, *baseScenario, *scenario);
177-
cube->set(shift, j, 0, i);
177+
try {
178+
Real shift = shiftCalculator->shift(key, *baseScenario, *scenario);
179+
cube->set(shift, j, 0, i);
180+
} catch (const std::exception& e) {
181+
StructuredAnalyticsErrorMessage(
182+
"HistocialSensiPnlCalculator",
183+
"Shift calcuation failed. Check consistency of simulation and sensi config.",
184+
"Error retrieving sensi key '" + ore::data::to_string(key) + "' from ssm scenario: '" + e.what())
185+
.log();
186+
}
178187
j++;
179188
}
180189
}

0 commit comments

Comments
 (0)