• 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 and presentError:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSError and presentError:


  • Subject: Re: NSError and presentError:
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 25 May 2008 15:14:50 -0700


On May 25, 2008, at 14:21, Seth Willits wrote:


So why is it that when the standard sheet for presentError: is displayed, it only ever uses NSLocalizedDescriptionKey and NSLocalizedRecoverySuggestionErrorKey? A lot of NSError objects don't have a value for NSLocalizedRecoverySuggestionErrorKey but they do have values for NSLocalizedFailureReasonErrorKey. Instead of using the failure reason, the sheet just doesn't show anything at all and only uses the description.


It's pretty silly to only show _some_ of the information available, but the other silly thing is that if I want to use presentError: to display an NSError object, I have to supply the *reason* something failed with NSLocalizedRecoverySuggestionErrorKey so that the reason actually is displayed, despite the fact it's a failure reason and not a recovery suggestion.

I could write my own method, and I suppose I probably should, but given there's existing methods and callbacks for the presentError: path, I wonder why it doesn't work as I think it should.


-- Seth Willits

I asked the same question a few weeks ago, thinking along the same lines as you.


The answer is actually in the error handling programming guide. It boils down to this:

NSLocalizedDescriptionKey is intended to be "You can't A because B"
NSLocalizedFailureReasonErrorKey intended to be "B"
NSLocalizedRecoverySuggestionErrorKey is intended to be "Try C instead"

Therefore, you don't need to display NSLocalizedFailureReasonErrorKey in a standard error alert because it's (supposed to be) part of NSLocalizedDescriptionKey already.


_______________________________________________

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: 
 >NSError and presentError: (From: Seth Willits <email@hidden>)

  • Prev by Date: NSError and presentError:
  • Next by Date: Re: How to Delay, Wait, Pause...
  • Previous by thread: NSError and presentError:
  • Next by thread: Re: NSError and presentError:
  • Index(es):
    • Date
    • Thread