Home | History | Annotate | Download | only in call-throws
      1 #import <Foundation/Foundation.h>
      2 
      3 @interface MyClass : NSObject
      4 {
      5 }
      6 - (int) callMeIThrow;
      7 @end
      8 
      9 @implementation MyClass
     10 - (int) callMeIThrow
     11 {
     12     NSException *e = [NSException
     13                        exceptionWithName:@"JustForTheHeckOfItException"
     14                        reason:@"I felt like it"
     15                        userInfo:nil];
     16     @throw e;
     17     return 56;
     18 }
     19 @end
     20 
     21 int
     22 main ()
     23 {
     24   int return_value;
     25   MyClass *my_class = [[MyClass alloc] init];
     26 
     27   NSLog (@"I am about to throw.");
     28 
     29   return_value = [my_class callMeIThrow];
     30 
     31   return return_value;
     32 }
     33