From 62a88e40c69f98879aa365a4f840f8b92272a9ec Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 30 Jan 2021 00:05:52 -0500 Subject: [PATCH] ensure to not swallowExceptions (thread safety) --- src/BirdsiteLive.Twitter/TwitterTweetsService.cs | 3 ++- src/BirdsiteLive.Twitter/TwitterUserService.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/BirdsiteLive.Twitter/TwitterTweetsService.cs b/src/BirdsiteLive.Twitter/TwitterTweetsService.cs index 38d1d68..7fdf391 100644 --- a/src/BirdsiteLive.Twitter/TwitterTweetsService.cs +++ b/src/BirdsiteLive.Twitter/TwitterTweetsService.cs @@ -35,7 +35,6 @@ namespace BirdsiteLive.Twitter _twitterUserService = twitterUserService; _logger = logger; Auth.SetApplicationOnlyCredentials(_settings.ConsumerKey, _settings.ConsumerSecret, true); - ExceptionHandler.SwallowWebExceptions = false; } #endregion @@ -43,6 +42,7 @@ namespace BirdsiteLive.Twitter { try { + ExceptionHandler.SwallowWebExceptions = false; TweetinviConfig.CurrentThreadSettings.TweetMode = TweetMode.Extended; var tweet = Tweet.GetTweet(statusId); _statisticsHandler.CalledTweetApi(); @@ -58,6 +58,7 @@ namespace BirdsiteLive.Twitter public ExtractedTweet[] GetTimeline(string username, int nberTweets, long fromTweetId = -1) { + ExceptionHandler.SwallowWebExceptions = false; TweetinviConfig.CurrentThreadSettings.TweetMode = TweetMode.Extended; var tweets = new List(); diff --git a/src/BirdsiteLive.Twitter/TwitterUserService.cs b/src/BirdsiteLive.Twitter/TwitterUserService.cs index e8729a6..4bb9448 100644 --- a/src/BirdsiteLive.Twitter/TwitterUserService.cs +++ b/src/BirdsiteLive.Twitter/TwitterUserService.cs @@ -27,12 +27,13 @@ namespace BirdsiteLive.Twitter _statisticsHandler = statisticsHandler; _logger = logger; Auth.SetApplicationOnlyCredentials(_settings.ConsumerKey, _settings.ConsumerSecret, true); - ExceptionHandler.SwallowWebExceptions = false; } #endregion public TwitterUser GetUser(string username) { + ExceptionHandler.SwallowWebExceptions = false; + IUser user; try {