Yehuda Katz wrote:
> This manifests itself in rescues as well:
>
> def caller_in_eval
> eval("raise 'w00t'")
> end
>
> def method_with_block
> begin
> yield
> rescue
> p "method_with_block"
> end
> end
>
> method_with_block do
> begin
> caller_in_eval
> rescue
> p "calling m_w_b"
> end
> end
>
> You would expect to see "method_with_block"
but instead get "calling m_w_b"
Why would you expect that? The "calling m_w_b"
rescue is the first one
encountered after the exception is raised.
- Cahrlie
|