• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSError: why returned directly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSError: why returned directly?


  • Subject: Re: NSError: why returned directly?
  • From: Scott Anguish <email@hidden>
  • Date: Wed, 26 Apr 2006 01:11:11 -0400


On Apr 25, 2006, at 7:49 PM, Ondra Cada wrote:

does anyone happen to know what is the rationale behind the particular way NSError is returned? It is well possible I am overlooking something pretty obvious, but it seems to me that in a sense, we are returning to the old bad days of error codes returned and explicitly tested anywhere, making the code unnecessarily complex and error-prone.


	(I'm sure Ali will pipe up if he has the time.. but)

The way that NSErrors are typically returned is by-reference parameters .

if a method returns nil instead of an object, and provides an error parameter, the error will provide more information. You can tell that it failed because it is nil. the error will tell you WHY it failed. this is info you can use to present more feedback.

similarly, if a method returns a BOOL YES for success, when it returns NO, an NSError can provide more info. if you're code fails, you can return NO, and pass the reason WHY the failure occurred up the chain.

Error Handling Programming Guide - <http://developer.apple.com/ documentation/Cocoa/Conceptual/ErrorHandlingCocoa/index.html#// apple_ref/doc/uid/TP40001806>
_______________________________________________
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
  • Follow-Ups:
    • Re: NSError: why returned directly?
      • From: "Keith Ray" <email@hidden>
    • Re: NSError: why returned directly?
      • From: Ondra Cada <email@hidden>
    • Re: NSError: why returned directly?
      • From: j o a r <email@hidden>
References: 
 >NSError: why returned directly? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Core Data: Save As workflow
  • Next by Date: Need suggestion on creating web form-filling application
  • Previous by thread: NSError: why returned directly?
  • Next by thread: Re: NSError: why returned directly?
  • Index(es):
    • Date
    • Thread