added error handling in provider supports

pull/702/head
Luke Pulverenti 11 years ago
parent 06ec5ebcb9
commit 4afe4f1ace

@ -116,7 +116,7 @@ namespace MediaBrowser.Server.Implementations.Providers
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
// Run the normal providers sequentially in order of priority // Run the normal providers sequentially in order of priority
foreach (var provider in MetadataProviders.Where(p => p.Supports(item))) foreach (var provider in MetadataProviders.Where(p => ProviderSupportsItem(p, item)))
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
@ -175,6 +175,25 @@ namespace MediaBrowser.Server.Implementations.Providers
return result; return result;
} }
/// <summary>
/// Providers the supports item.
/// </summary>
/// <param name="provider">The provider.</param>
/// <param name="item">The item.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
private bool ProviderSupportsItem(BaseMetadataProvider provider, BaseItem item)
{
try
{
return provider.Supports(item);
}
catch (Exception ex)
{
_logger.ErrorException("{0} failed in Supports for type {1}", ex, provider.GetType().Name, item.GetType().Name);
return false;
}
}
/// <summary> /// <summary>
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done /// Fetches metadata and returns true or false indicating if any work that requires persistence was done
/// </summary> /// </summary>

Loading…
Cancel
Save