Monday, August 13, 2007

Ruby Exceptions and instance_eval

I started working on the tax natural language project again and noticed that whenever the parser encountered a line of text it did not understand, an exception was thrown. This is the intended behavior although I was not able to catch the error. After a few minutes on Google, I found an article stating that in order to catch errors thrown through this method, the custom exception class MUST inherit from StandardError. Once I made this change all worked as expected.

http://hasno.info/2006/12/14/ruby-gotchas-and-caveats

No comments: