Re: NSError: why returned directly?
Re: NSError: why returned directly?
- Subject: Re: NSError: why returned directly?
- From: Ali Ozer <email@hidden>
- Date: Wed, 26 Apr 2006 09:01:45 -0700
Well, Apple just says: We make the distinction between programming
errors and user-level errors; the first one should be handled by
exceptions, and the second one by return-codes and error parameters.
Why that? I still don't know. When I read it the first time, I was
surprised, and it still seems kind of artificial and arbitrary
(yes, computers and programs are always "artificial" and
"arbitrary", but you get the point ;-).
Programmer errors are defects in the product that should be fixed
before you ship your application. There the important thing is to
catch as many as possible, provide debugging hooks, but not
necessarily provide good end-user error messages. Shipping code
isn't expected to handle them, and as Glenn Andreas pointed out,
exceptions should never occur in a shipping product. Typically the
recommended way to deal with these kind of exceptions is with a top-
level handler that tells the user something went wrong, apologizes,
and asks them to save and quit.
User errors are things that might happen to the user. Those are
problems that the program is supposed to handle, and continue
execution. Since the less predictable flow of control in exceptions
tends to make it harder to clean-up fully, we stay away from
exceptions for those, and instead recommend the traditional ways of
signalling errors through return values.
Ali
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden