Exceptions/Catch an exception thrown in a nested call: Difference between revisions

Content deleted Content added
Steenslag (talk | contribs)
m →‎{{header|Ruby}}: inherit from StandardError (not Exception)
Steenslag (talk | contribs)
→‎{{header|Ruby}}: Added comment
Line 1,984: Line 1,984:
foo
foo
foo </lang>
foo </lang>
The first call to foo causes the U0 exception. It gets caught and handled. The second call results in a U1 exception which is not caught, so the program dumps a stacktrace and exits.
{{out}}
{{out}}
<pre>$ ruby test2.rb
<pre>$ ruby test2.rb