Improve error handling of msg move/copy actions
parent
84a2c70c87
commit
5909810b1f
|
@ -431,7 +431,7 @@
|
|||
destinationFolder = [data objectForKey: @"folder"];
|
||||
response = nil;
|
||||
|
||||
if ([uids count] > 0)
|
||||
if ([uids count] > 0 && destinationFolder)
|
||||
{
|
||||
response = [co copyUIDs: uids toFolder: destinationFolder inContext: context];
|
||||
if (!response)
|
||||
|
@ -446,6 +446,12 @@
|
|||
else
|
||||
response = [self responseWithStatus: 200];
|
||||
}
|
||||
else
|
||||
{
|
||||
data = [NSDictionary dictionaryWithObject: [(NSException *)response reason]
|
||||
forKey: @"message"];
|
||||
response = [self responseWithStatus: 500 andJSONRepresentation: data];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -477,7 +483,7 @@
|
|||
destinationFolder = [data objectForKey: @"folder"];
|
||||
response = nil;
|
||||
|
||||
if ([uids count] > 0)
|
||||
if ([uids count] > 0 && destinationFolder)
|
||||
{
|
||||
response = [co moveUIDs: uids toFolder: destinationFolder inContext: context];
|
||||
if (!response)
|
||||
|
@ -501,10 +507,16 @@
|
|||
}
|
||||
response = [self responseWith204];
|
||||
}
|
||||
else
|
||||
{
|
||||
data = [NSDictionary dictionaryWithObject: [(NSException *)response reason]
|
||||
forKey: @"message"];
|
||||
response = [self responseWithStatus: 500 andJSONRepresentation: data];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data = [NSDictionary dictionaryWithObject: [self labelForKey: @"Error moving messages." inContext: context]
|
||||
data = [NSDictionary dictionaryWithObject: @"Error 'uids' and/or 'folder' parameters."
|
||||
forKey: @"message"];
|
||||
response = [self responseWithStatus: 500 andJSONRepresentation: data];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue