From 18ae7894c6d34d31a4273cf113a5aeddb205b366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 15 Jul 2014 17:32:12 +0200 Subject: [PATCH] Better error message when block option when a variable does not appear at current period. --- ModelTree.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ModelTree.cc b/ModelTree.cc index a83ea06f..7bdd78ae 100644 --- a/ModelTree.cc +++ b/ModelTree.cc @@ -207,8 +207,17 @@ ModelTree::computeNonSingularNormalization(jacob_map_t &contemporaneous_jacobian dynamic_jacobian[make_pair(0, make_pair(it->first.first, it->first.second))] = 0; if (contemporaneous_jacobian.find(make_pair(it->first.first, it->first.second)) == contemporaneous_jacobian.end()) contemporaneous_jacobian[make_pair(it->first.first, it->first.second)] = 0; - if (first_derivatives.find(make_pair(it->first.first, getDerivID(symbol_table.getID(eEndogenous, it->first.second), 0))) == first_derivatives.end()) - first_derivatives[make_pair(it->first.first, getDerivID(symbol_table.getID(eEndogenous, it->first.second), 0))] = Zero; + try + { + if (first_derivatives.find(make_pair(it->first.first, getDerivID(symbol_table.getID(eEndogenous, it->first.second), 0))) == first_derivatives.end()) + first_derivatives[make_pair(it->first.first, getDerivID(symbol_table.getID(eEndogenous, it->first.second), 0))] = Zero; + } + catch(DataTree::UnknownDerivIDException &e) + { + cerr << "The variable " << symbol_table.getName(symbol_table.getID(eEndogenous, it->first.second)) + << " does not appear at the current period (i.e. with no lead and no lag); this case is not handled by the 'block' option of the 'model' block." << endl; + exit(EXIT_FAILURE); + } } } }