From: Glen Holcomb Date: 2008-10-02T00:37:59+09:00 Subject: Re: "ensure" hiding actual error ------=_Part_10802_3685362.1222875547011 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, Oct 1, 2008 at 9:32 AM, Nit Khair wrote: > Glen Holcomb wrote: > > On Wed, Oct 1, 2008 at 9:08 AM, Nit Khair wrote: > > > >> >> problems with handling correctly the original exception. > >> ensure > >> my_form.free_form. > >> ... > >> end > >> > > > > What happens here if my_form never got a value because there was an > > error > > previous that made create_... invalid? > > > > What Thomas is saying is that there is an exception being raised by the > > code > > present in your ensure block. > > > > > Fine. I get that. So is there a better or correct way of doing this so > that I get the original error that was raised. > > Aaaah. so you mean if i check for my_form before freeing, then ... since > no new exception is raised, the original exception will be displayed. > So I _should_ say: > > ensure > if !my_form.nil? > my_form.free ... etc > end > -- > Posted via http://www.ruby-forum.com/. > > Yeah! -- "Hey brother Christian with your high and mighty errand, Your actions speak so loud, I can't hear a word you're saying." -Greg Graffin (Bad Religion) ------=_Part_10802_3685362.1222875547011--