Skip to content

Instantly share code, notes, and snippets.

@biac
Created December 6, 2011 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biac/1437545 to your computer and use it in GitHub Desktop.
Save biac/1437545 to your computer and use it in GitHub Desktop.
FeedReader: 非同期実行中の例外をシミュレートする仕掛け
public class FeedReader
{
#if DEBUG
public string test__RaiseErrorUrl;
public Exception test__RaiseException;
#endif
// (略)
private async Task<FeedData> ReadAsync(Uri feedUri)
{
SyndicationClient client = new SyndicationClient() { BypassCacheOnRetrieve = true };
SyndicationFeed feed = await client.RetrieveFeedAsync(feedUri);
#if DEBUG
if (feedUri.OriginalString == this.test__RaiseErrorUrl)
throw this.test__RaiseException;
#endif
return feed.ToFeedData();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment