added error handling in provider supports
This commit is contained in:
parent
06ec5ebcb9
commit
4afe4f1ace
|
@ -116,7 +116,7 @@ namespace MediaBrowser.Server.Implementations.Providers
|
|||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
// 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();
|
||||
|
||||
|
@ -175,6 +175,25 @@ namespace MediaBrowser.Server.Implementations.Providers
|
|||
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>
|
||||
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user