• 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: glenn andreas <email@hidden>
  • Date: Wed, 26 Apr 2006 10:34:20 -0500


On Apr 26, 2006, at 9:07 AM, Erik Buck wrote:

IMHO, exceptions should be reserved for “this should never happen” type situations. Frankly, I think exceptions should be reserved for situations where NSAssert() is used.

You mean, like, for "exceptional" circumstances?

I'd basically go so far as to say that exceptions should, in a bug free program running on a perfectly stable system & environment, never be hit (of course, these conditions don't actually exist) . If there is a condition that the developer expects might happen "in the real world", exceptions aren't the right way to handle this. For example, one expects the network to go away, hard disks to fill up, etc..., but few programs would expect your connection to the window server goes away and suddenly you are unable to call graphics routines.

This makes exceptions something that are also nearly impossible to test (since those conditions shouldn't happen).

I've seen far too many things that treat exceptions as "just another way to return values", which is, as far as I'm concerned, completely the wrong way to view things...




Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! Widgetarium | the quickest path to widgets

_______________________________________________
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


References: 
 >Re: NSError: why returned directly? (From: Erik Buck <email@hidden>)

  • Prev by Date: Re: Question about MVC
  • Next by Date: Re: NSError: why returned directly?
  • Previous by thread: Re: NSError: why returned directly?
  • Next by thread: Re: NSError: why returned directly?
  • Index(es):
    • Date
    • Thread