throwing an exception in objective-c/cocoa

Steph Thirion picture Steph Thirion · Nov 27, 2008 · Viewed 135.4k times · Source

What's the best way to throw an exception in objective-c/cocoa?

Answer

e.James picture e.James · Nov 27, 2008

I use [NSException raise:format:] as follows:

[NSException raise:@"Invalid foo value" format:@"foo of %d is invalid", foo];