I would like to be able to add additional context info to certain exceptions 
that the system might generate. Since NSException's userInfo dict is nil in 
such cases it would be convenient to add an error context dict to the exception 
and then handle/display it.

  @try {
    ...;
  }
  @catch (NSException *e) {
    e.userInfo = [NSDictionary dictionaryWithObject:@"Unsupported session 
resolution" 
                                             andKey:@"Context"];
        --> No setter method "setUserInfo:" for assignment to property
    [ self showException: e ];
  }
  @finally {
    ...;
  }

Unfortunately I can't just add my own userInfo dict onto the exception, as 
there is no setter for it by default. Would it be heresy to create an 
NSException category to implement the -setUserInfo: method to do this? What is 
a better way to handle this?

-Carl


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to