Exceptions/Catch an exception thrown in a nested call: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
|||
Line 993: | Line 993: | ||
</pre> |
</pre> |
||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
ELENA |
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 |
U0.raise() |
||
} |
} |
||
else |
else |
||
{ |
{ |
||
U1 |
U1.raise() |
||
} |
} |
||
} |
} |
||
Line 1,027: | Line 1,035: | ||
self.bar() |
self.bar() |
||
} |
} |
||
catch |
catch(U0 e) |
||
{ |
{ |
||
console.printLine("U0 Caught") |
console.printLine("U0 Caught") |