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

Content added Content deleted
Line 993: Line 993:
</pre>
</pre>
=={{header|Elena}}==
=={{header|Elena}}==
ELENA 4.1 :
ELENA 5.0 :
<lang elena>import extensions;
<lang elena>import extensions;
class U0 : Exception;
class U0 : Exception
{
constructor new()
<= new();
}
class U1 : Exception;
class U1 : Exception
{
constructor new()
<= new();
}
singleton Exceptions
singleton Exceptions
Line 1,011: Line 1,019:
if (i == 0)
if (i == 0)
{
{
U0.new().raise()
U0.raise()
}
}
else
else
{
{
U1.new().raise()
U1.raise()
}
}
}
}
Line 1,027: Line 1,035:
self.bar()
self.bar()
}
}
catch:(U0 e)
catch(U0 e)
{
{
console.printLine("U0 Caught")
console.printLine("U0 Caught")