Exceptions: Difference between revisions

Content deleted Content added
Add NetRexx implementation
Line 1,123:
'''Shorthand'''
<lang moo>`this:foo()!ANY=>this:bar()';</lang>
 
=={{header|NetRexx}}==
As <tt>NetRexx</tt> runs under the control of a JVM it has the same exception model as [[#Java|Java]].
<lang NetRexx>/* NetRexx */
options replace format comments java crossref symbols nobinary
 
-- =============================================================================
class RExceptions public
 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method test() public signals RExceptions.TakeException
if (1 == 1) then signal RExceptions.TakeException()
return
 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method main(args = String[]) public static
do
RExceptions().test()
catch ex = Exception
say ex.toString()
end
 
return;
 
-- =============================================================================
class RExceptions.TakeException public extends Exception
 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method TakeException() public
super('I resent that!')
return
</lang>
'''Output:'''
<pre>
RExceptions$TakeException: I resent that!
</pre>
 
=={{header|Objective-C}}==