• 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: @try @catch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: @try @catch


  • Subject: Re: @try @catch
  • From: Michael Watson <email@hidden>
  • Date: Thu, 14 Aug 2008 14:38:22 -0400

Don't forget that many of Apple's own methods return nil on failure and don't implement an NSError reference mechanism. NSFileManager's - contentsAtPath: method returns either an NSData object on success or nil on failure.


-- m-s

On 14 Aug, 2008, at 08:45, Uli Kusterer wrote:

On 14.08.2008, at 12:58, Georg Seifert wrote:
is it recommended to use @try .. @catch blocks as flow control like it is used in Python. They say explicitly to use it rather than do a lot of test before just try if it works to look after it only if it fails.


Apple's stance on exceptions so far has been that, with the exception of some proxy objects (e.g. Distributed Objects), they should be used in Cocoa for programming errors only. Otherwise, you're supposed to return a BOOL, or an NSError, e.g. via a reference parameter, if more detailed failure info is needed.

Whether I consider that good or bad, it's what Apple recommend.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





_______________________________________________

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:
@bungie.org


This email sent to email@hidden

_______________________________________________

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


  • Follow-Ups:
    • Re: @try @catch
      • From: Uli Kusterer <email@hidden>
    • Re: @try @catch
      • From: "Clark Cox" <email@hidden>
References: 
 >@try @catch (From: Georg Seifert <email@hidden>)
 >Re: @try @catch (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Why does Core Data retain an object when one of that object's attributes is changed?
  • Next by Date: Threading problem using AsyncSocket
  • Previous by thread: Re: @try @catch
  • Next by thread: Re: @try @catch
  • Index(es):
    • Date
    • Thread