Re: Presenting NSLocalizedFailureReasonErrorKey
Re: Presenting NSLocalizedFailureReasonErrorKey
- Subject: Re: Presenting NSLocalizedFailureReasonErrorKey
- From: Hank Heijink <email@hidden>
- Date: Mon, 1 Oct 2007 14:28:20 -0400
Look at the Error Handling programming guide. In the section on The
User Info Dictionary, it has this to say about the failure reason:
"A brief sentence that explains the reason why the error occurred. It
is typically part of the error description. Methods such as
presentError: do not automatically display the failure reason because
it is already included in the error description. The failure reason
is for clients that only want to display the reason for the failure."
So, unless you want to write your own error displaying routine, you
should stick the failure reason in the NSLocalizedDescriptionKey.
Cheers,
Hank
On Oct 1, 2007, at 2:15 PM, Jerry Krinock wrote:
Method -presentError: presents a modal dialog showing an NSError.
It shows the domain and the code, but not the
NSLocalizedFailureReasonErrorKey from the userInfo dictionary. Why
not? I must be doing something wrong. Is not
NSLocalizedFailureReasonErrorKey far more informative to the user
than the domain or code number?
Jerry Krinock
TEST CODE:
NSDictionary *userInfo ;
userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
@"That dog won't hunt.", NSLocalizedFailureReasonErrorKey,
nil] ;
NSError* error ;
error = [NSError errorWithDomain:@"com.MyCompany.ErrorDomain"
code:123
userInfo:userInfo] ;
[[NSApplication sharedApplication] presentError:error] ;
EXPECTED RESULT:
A modal dialog saying something like:
"That dog won't hunt. com.MyCompany.ErrorDomain error #123"
ACTUAL RESULT:
A modal dialog saying only:
"com.MyCompany.ErrorDomain error #123"
_______________________________________________
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:
40runbox.com
This email sent to email@hidden
Hank Heijink
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