Better support for setting errors inside -dataOfType:error: and -readFromData:ofType:error:.

Previously, under GNUstep, NSLocalizedFailureReasonKey was ignored when
presented with +[NSAlert alertWithError]. Additionally, error set in
-readFromData:ofType:error: was overwritten by two different methods in the
file reading chain.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38483 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ivucica 2015-05-10 19:10:56 +00:00
parent acf05990fa
commit daa905a169
3 changed files with 24 additions and 4 deletions

View file

@ -641,8 +641,9 @@ withContentsOfURL: (NSURL *)url
if (data == nil)
{
*error = create_error(0, NSLocalizedString(@"Could not create data for type.",
@"Error description"));
if (error && !(*error))
*error = create_error(0, NSLocalizedString(@"Could not create data for type.",
@"Error description"));
return nil;
}
return AUTORELEASE([[NSFileWrapper alloc] initRegularFileWithContents: data]);
@ -1022,7 +1023,7 @@ withContentsOfURL: (NSURL *)url
error: error];
if (wrapper == nil)
{
if (error)
if (error && !(*error))
{
*error = create_error(0, NSLocalizedString(@"Could not write file wrapper.",
@"Error description"));