NSException category?
NSException category?
- Subject: NSException category?
- From: Carl Hoefs <email@hidden>
- Date: Thu, 06 Feb 2014 11:44:52 -0700
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 (email@hidden)
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:
This email sent to email@hidden