private async Task <ISyndicationFeedSource> TryLoadFeedAsync(IAmACommunityMember tamarin, Uri uri) { try { var iFilterMyBlogPosts = tamarin as IFilterMyBlogPosts; var filter = iFilterMyBlogPosts != null ? (Func <SyndicationItem, bool>)iFilterMyBlogPosts.Filter : (si => true); var feedSource = new DummyRemoteSyndicationFeedSource(); var feed = await FetchAsync(uri, filter).ConfigureAwait(false); feedSource.Feed = feed; return(feedSource); } catch (Exception ex) { Logger.Error(ex, $"{tamarin.FirstName} {tamarin.LastName}'s feed of {uri} failed to load."); // Not my problem if your feed asplodes but we at least won't crash the app for all the other nice people :) return(null); } }
private async Task <ISyndicationFeedSource> TryLoadFeedAsync(IAmACommunityMember tamarin, Uri uri, bool tryAgain) { try { var feedSource = new DummyRemoteSyndicationFeedSource(); var filter = GetFilterFunction(tamarin); var client = GetHttpClient(); var feed = await FetchAsync(client, uri, filter).ConfigureAwait(false); feed.Language = CultureInfo.CreateSpecificCulture(tamarin.FeedLanguageCode).Name; feedSource.Feed = feed; return(feedSource); } catch (Exception ex) { Logger.Error(ex, $"{tamarin.FirstName} {tamarin.LastName}'s feed of {uri} failed to load."); if (tryAgain) { return(await TryLoadFeedAsync(tamarin, uri, false)); } } // Not my problem if your feed asplodes but we at least won't crash the app for all the other nice people :) return(null); }