My application (Ruby 1.9.2) can increase individual exceptions, including Net-connection Breaks. I rescue exception => E
, then case / when
to handle them in defferent ways, but many errors go directly from my code to else
.
Rescue exception = & gt; EP e. Class case e Class when Earno :: Econressetti P1 when Erro :: Econnesseti, Erro :: Unicorned, Erro :: ETMDougou P2 and P3 End and
Prints:
This is because === Operator works on the
case
statement on class class
== =
against which object Assessment if you want to test for the e
category , You just e , not e.class
. This is because because in e.class
the case falls, because, okay, e.class is a class.
Rescue exception = & gt; E-Case E When Earno :: Econaressetti P1 When Arro :: Econaressetti, Erro :: Unicorned, Erro :: ETMDougou P2 and P3 End and
Yes, there is a strange wording in Ruby Occasionally
Comments
Post a Comment