From ed1588722173807a17b6b6dbdd299393ec395a0c Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Wed, 2 Apr 2008 15:18:51 +0000
Subject: [PATCH] v4 preprocessor: catch evaluation error in
 ModelTree::evaluateJacobian to avoid abrupt program exiting

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1776 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 ModelTree.cc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/ModelTree.cc b/ModelTree.cc
index b2e7ee74..08a96a87 100644
--- a/ModelTree.cc
+++ b/ModelTree.cc
@@ -3592,7 +3592,15 @@ ModelTree::evaluateJacobian(const eval_context_type &eval_context, jacob_map *j_
       if (variable_table.getType(it->first.second) == eEndogenous)
         {
           NodeID Id = it->second;
-          double val = Id->eval(eval_context);
+          double val;
+          try
+            {
+              val = Id->eval(eval_context);
+            }
+          catch(ExprNode::EvalException &e)
+            {
+              cerr << "ModelTree::evaluateJacobian: evaluation of Jacobian failed!" << endl;
+            }
           int eq=it->first.first;
           int var=variable_table.getSymbolID(it->first.second);
           int k1=variable_table.getLag(it->first.second);
-- 
GitLab