Exception while loading shared folder tree nodes is now logged. Any nodes whose parents are missing are silently ignored.

This commit is contained in:
Patrick Simpson 2017-03-22 13:44:52 +01:00
parent e9ec0cd855
commit 5daff1dc44
2 changed files with 6 additions and 2 deletions

View File

@ -107,6 +107,7 @@ namespace Acacia.Controls
}, true)
.OnError(error =>
{
Logger.Instance.Error(this, "Exception while fetching child nodes: {0}", error);
// On error return an empty node list
State = LoadingState.Error;
return new KTreeNodes(node);

View File

@ -96,10 +96,13 @@ namespace Acacia.ZPush.API.SharedFolders
rootNodes.Add(folder);
parent = null;
}
else if (!foldersByServerId.ContainsKey(folder.ParentId))
{
// Ignore the node if the parent is not available
continue;
}
else
{
if (!foldersByServerId.ContainsKey(folder.ParentId))
throw new Exception("Missing parent folder: " + folder.ParentId);
parent = foldersByServerId[folder.ParentId];
parent.Children.Add(folder);
}