Skip to content
Browse files

Protect logs from raises

  • Loading branch information...
1 parent 18c12d1 commit 3382768fcc2772723574876b170a380eafd98e6a clbustos committed Apr 15, 2010
Showing with 5 additions and 13 deletions.
  1. +5 −1 lib/minimization.rb
  2. +0 −4 svn-commit.2.tmp
  3. +0 −4 svn-commit.3.tmp
  4. +0 −4 svn-commit.tmp
View
6 lib/minimization.rb
@@ -250,7 +250,11 @@ def iterate
k+=1
result=brent_iterate
raise "Error on iteration" if !result
- @log+=sprintf("%d: [%0.5f - %0.5f] -> [%0.5f - %0.5f] E: %0.6f\n", k, @x_lower, @x_upper, @f_lower, @f_upper, (@x_lower-@x_upper).abs)
+ begin
+ @log+=sprintf("%d: [%0.5f - %0.5f] -> [%0.5f - %0.5f] E: %0.6f\n", k, @x_lower, @x_upper, @f_lower, @f_upper, (@x_lower-@x_upper).abs)
+ rescue =>@e
+ @log+=@e.to_s
+ end
end
@iterations=k
return true
View
4 svn-commit.2.tmp
@@ -1,4 +0,0 @@
-First version of minimization
---Esta línea y las que están debajo serán ignoradas--
-
-A https://ruby-statsample.googlecode.com/minimization
View
4 svn-commit.3.tmp
@@ -1,4 +0,0 @@
-First version
---Esta línea y las que están debajo serán ignoradas--
-
-A https://ruby-statsample.googlecode.com/minimization
View
4 svn-commit.tmp
@@ -1,4 +0,0 @@
-First version of minimization
---Esta línea y las que están debajo serán ignoradas--
-
-A .

0 comments on commit 3382768

Please sign in to comment.
Something went wrong with that request. Please try again.