• 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: odd behavior with NSError?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: odd behavior with NSError?


  • Subject: Re: odd behavior with NSError?
  • From: mmalc Crawford <email@hidden>
  • Date: Thu, 15 Oct 2009 23:05:05 -0700

On Oct 15, 2009, at 10:41 pm, Nathan Vander Wilt wrote:

> Ouch. So the following pattern is incorrect?
>
> NSError* internalError = nil;
> (void)[foo somethingReturningBool:bar error:&internalError];
> if (internalError) {
>    // ...
> }
>
<http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/ErrorHandlingCocoa/CreateCustomizeNSError/CreateCustomizeNSError.html#//apple_ref/doc/uid/TP40001806-CH204-BAJIIGCC>

Note: Cocoa methods that indirectly return error objects in the Cocoa error domain are guaranteed to return such objects if the method indicates failure by directly returning nil or NO. With such methods, you should always check if the return value is nil or NO before attempting to do anything with the NSError object.

mmalc

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: odd behavior with NSError? (From: Gregory Weston <email@hidden>)
 >Re: odd behavior with NSError? (From: Bill Bumgarner <email@hidden>)
 >Re: odd behavior with NSError? (From: Nathan Vander Wilt <email@hidden>)

  • Prev by Date: Re: odd behavior with NSError?
  • Next by Date: Re: How to detect and disable/delay sleep event in cocoa for some critical threads to complete
  • Previous by thread: Re: odd behavior with NSError?
  • Next by thread: Re: odd behavior with NSError?
  • Index(es):
    • Date
    • Thread