Reduce the amount of exceptions thrown

This commit is contained in:
Bond_009
2019-02-24 15:47:59 +01:00
committed by Bond-009
parent 10a0d6bdba
commit 37ea50a572
13 changed files with 632 additions and 82 deletions

View File

@@ -278,6 +278,7 @@ namespace Emby.Server.Implementations.Library
{
throw new ArgumentNullException(nameof(item));
}
if (item is IItemByName)
{
if (!(item is MusicArtist))
@@ -285,18 +286,7 @@ namespace Emby.Server.Implementations.Library
return;
}
}
else if (item.IsFolder)
{
//if (!(item is ICollectionFolder) && !(item is UserView) && !(item is Channel) && !(item is AggregateFolder))
//{
// if (item.SourceType != SourceType.Library)
// {
// return;
// }
//}
}
else
else if (!item.IsFolder)
{
if (!(item is Video) && !(item is LiveTvChannel))
{
@@ -371,19 +361,20 @@ namespace Emby.Server.Implementations.Library
foreach (var metadataPath in GetMetadataPaths(item, children))
{
_logger.LogDebug("Deleting path {0}", metadataPath);
if (!Directory.Exists(metadataPath))
{
continue;
}
_logger.LogDebug("Deleting path {MetadataPath}", metadataPath);
try
{
Directory.Delete(metadataPath, true);
}
catch (IOException)
{
}
catch (Exception ex)
{
_logger.LogError(ex, "Error deleting {metadataPath}", metadataPath);
_logger.LogError(ex, "Error deleting {MetadataPath}", metadataPath);
}
}