O'Reilly - Objective-C Pocket Reference - Ripped by Caudex 2003 by By Andrew M. Duncan
Author:By Andrew M. Duncan
Language: eng
Format: epub
1.8 Runtime Errors
Runtime errors include program errors like unhandled method calls or messages sent to released objects, and hardware errors like division by zero. The Object root class provides simple error-handling capability; the Cocoa framework implements exception raising and handling.
1.8.1 Object Error Handling
When an error occurs, the runtime sets in motion the following sequence of events:
1. The runtime calls the -error: method on the object whose method generated the error. You can override this method to customize error handling for a particular class.
2. The -error: method prepares information about the receiver and passes it to the runtime C function objc_verror( ).
3. The objc_verror( ) function calls the runtime error handler function if there is one; otherwise it writes an error message to stderr. You can provide a handler function to customize error handling for all classes.
4. If the error handler exists (because you've provided one) and it returns YES, execution continues; otherwise the program calls the C function abort( ) and exits.
The GNU runtime provides a function to set your own error handler function:
objc_error_handler objc_set_error_handler(objc_error_handler f)
Calling this function sets a new error handler and returns the previous one. The default error handler is a NULL pointer. The required signature of an error handler is declared (in objc-api.h) as:
typedef BOOL (*objc_error_handler)
(id receiver,
int errCode,
const char* format,
va_list args);
Here are descriptions of the parameters your error handler will get:
receiver
The object in whose method the error occurred.
errCode
One of a set of integers declared in the header file objc-api.h along with objc_error_handler.
format
A printf-style C string, for printing an error message.
args
A variable-length list of values for the format string. You can print the error message using the format and argument list and the C function vprintf( ).
Use the first two parameters to decide how to handle the error, and the second two to print a message.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
What's Done in Darkness by Kayla Perrin(26605)
The Fifty Shades Trilogy & Grey by E L James(19087)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19073)
Shot Through the Heart by Mercy Celeste(18944)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(17125)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(17006)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16886)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16835)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16459)
The Subtle Art of Not Giving a F*ck by Mark Manson(14365)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14151)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13656)
Scorched Earth by Nick Kyme(12779)
Drei Generationen auf dem Jakobsweg by Stein Pia(10972)
Suna by Ziefle Pia(10895)
Scythe by Neal Shusterman(10353)
The Ultimate Python Exercise Book: 700 Practical Exercises for Beginners with Quiz Questions by Copy(9890)
D:\Jan\FTP\HOL\Work\Alien Breed - Tower Assault CD32 Alien Breed II - The Horror Continues Manual 1.jpg by PDFCreator(9863)
De Souza H. Master the Age of Artificial Intelligences. The Basic Guide...2024 by Unknown(9847)
