RosettaCodeData/Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/FutureBasic/exceptions-catch-an-exception-thrown-in-a-nested-call.basic
2024-11-04 21:53:44 -08:00

33 lines
534 B
Text

include "NSLog.incl"
void local fn Baz( i as int )
if ( i == 0 )
throw fn ExceptionWithName( @"U0", @"U0", NULL )
else
throw fn ExceptionWithName( @"U1", @"U1", NULL )
end if
end fn
void local fn Bar( i as int )
fn Baz(i)
end fn
void local fn Foo
ExceptionRef e
for int i = 0 to 1
try
fn Bar(i)
end try
catch ( e )
if ( fn StringIsEqual( fn ExceptionName(e), @"U0" ) )
NSLog(@"Function Foo caught exception %@",e)
end if
end catch
next
end fn
fn Foo
HandleEvents