In Objective-C, we use exceptions for handling unexpected errors, which is similar to the concept of panic in other languages. The @throw directive is used to raise an exception.
Running this program will cause it to throw an exception, print an error message and stack trace, and exit with a non-zero status.
When the first @throw in main fires, the program exits without reaching the rest of the code. If you’d like to see the program try to create a temp file, comment out the first @throw.
Note that unlike some languages which use exceptions for handling of many errors, in Objective-C it is common to use error-indicating return values (like NSError) wherever possible, and use exceptions for truly exceptional circumstances.