Re: ObjC error messages
Re: ObjC error messages
- Subject: Re: ObjC error messages
- From: Malte Tancred <email@hidden>
- Date: Thu, 14 Feb 2002 13:16:01 +0100
As Ondra Cada suggested -doesNotRecognizeSelector: is causing the
NSLog(). From the documentation on NSObject:
...
- (void)doesNotRecognizeSelector:(SEL)aSelector
Handles aSelector messages the receiver doesn't recognize. The
run-time system invokes this method whenever an object receives
an aSelector message it can't respond to or forward. This method,
in turn, raises an NSInvalidArgumentException, and generates an
error message.
...
Raising an exception is the correct way to handle this. However,
printing out error messages to stderr without anyone asking for
it is not.
A request to Apple: could the error message produced by the
method -doesNotRecognizeSelector: be made optional? I would prefer
"opt-in" optional.
Cheerio,
Malte
On friday, february 1, 2002, at 04:01 , Malte Tancred wrote:
From what I see in libobjc there is a funtion handling runtime errors.
This function (_error) can be overridden by an application. The default
implementation logs to syslog.
Using foundation, sending a message to an object that doesn't doesn't
implement that method yields what seems to be an NSLog where part of
the text is 'selector not recognized'. I have not been able to find
this string in any of the files in libobjc (just checked it out).
Hence, I draw the conclusion that Foundation defines it's own _error
function.
I still want the error messages suppressed unless turned on. :-)
--
Malte Tancred
Computer programmer, Oops AB, Sweden
mailto:email@hidden
http://www.oops.se/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.