From d97683c26e4d93632a115ddb16ef2ca8ffa0fff9 Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Thu, 3 Sep 2009 16:22:50 +0000
Subject: [PATCH] Improve treatment of error messages in homotopy

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2895 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 matlab/homotopy1.m | 6 +-----
 matlab/homotopy2.m | 6 +-----
 matlab/homotopy3.m | 3 ++-
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/matlab/homotopy1.m b/matlab/homotopy1.m
index db11e1de41..23347677a5 100644
--- a/matlab/homotopy1.m
+++ b/matlab/homotopy1.m
@@ -77,9 +77,5 @@ function homotopy1(values, step_nbr)
     oo_.exo_steady_state(values(ix,2)) = points(ix,i);
     oo_.exo_det_steady_state(values(ixd,2)) = points(ixd,i);
 
-    try
-      steady_;
-    catch
-      error('HOMOTOPY mode 1: failed')
-    end
+    steady_;
   end
diff --git a/matlab/homotopy2.m b/matlab/homotopy2.m
index eb53778d2a..c66213f070 100644
--- a/matlab/homotopy2.m
+++ b/matlab/homotopy2.m
@@ -100,11 +100,7 @@ function homotopy2(values, step_nbr)
 
       disp([ 'HOMOTOPY mode 2: lauching solver with ' strtrim(varname) ' = ' num2str(v) ' ...'])
       
-      try
-        steady_;
-      catch
-        error('HOMOTOPY mode 2: failed')
-      end
+      steady_;
     end
   end
   
\ No newline at end of file
diff --git a/matlab/homotopy3.m b/matlab/homotopy3.m
index 15148fd227..6cd4d98b4f 100644
--- a/matlab/homotopy3.m
+++ b/matlab/homotopy3.m
@@ -103,7 +103,8 @@ function homotopy3(values, step_nbr)
       end
       oldvalues = curvalues;
       inc = 2*inc;
-    catch
+    catch E
+      disp(E.message)
       disp('HOMOTOPY mode 3: failed step, now dividing increment by 2...')
       inc = inc/2;
       oo_.steady_state = old_ss;
-- 
GitLab