Skip to content

Commit

Permalink
Fix emote provider HTTPRequestException message assuming an HTTP stat…
Browse files Browse the repository at this point in the history
…us code exists (#1239)
  • Loading branch information
ScrubN authored Oct 30, 2024
1 parent b2bbfea commit 1584c99
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions TwitchDownloaderCore/TwitchHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,15 @@ public static async Task<List<TwitchEmote>> GetThirdPartyEmotes(List<Comment> co
}
catch (HttpRequestException e)
{
logger.LogError($"BetterTTV returned HTTP {e.StatusCode}. BTTV emotes may not be present for this session.");
var message = e.StatusCode != null
? $"BetterTTV returned HTTP {e.StatusCode}."
: e.Message;

logger.LogError($"{message} Some BTTV emotes may not be present for this session.");
}
catch (TaskCanceledException ex) when (ex.Message.Contains("HttpClient.Timeout"))
{
logger.LogError("BetterTTV timed out. Some BTTV emotes may not be present for this session.");
}
}

Expand All @@ -416,7 +424,15 @@ public static async Task<List<TwitchEmote>> GetThirdPartyEmotes(List<Comment> co
}
catch (HttpRequestException e)
{
logger.LogError($"FFZ returned HTTP {e.StatusCode}. FFZ emotes may not be present for this session.");
var message = e.StatusCode != null
? $"FFZ returned HTTP {e.StatusCode}."
: e.Message;

logger.LogError($"{message} Some FFZ emotes may not be present for this session.");
}
catch (TaskCanceledException ex) when (ex.Message.Contains("HttpClient.Timeout"))
{
logger.LogError("FFZ timed out. Some FFZ emotes may not be present for this session.");
}
}

Expand All @@ -428,7 +444,15 @@ public static async Task<List<TwitchEmote>> GetThirdPartyEmotes(List<Comment> co
}
catch (HttpRequestException e)
{
logger.LogError($"7TV returned HTTP {e.StatusCode}. 7TV emotes may not be present for this session.");
var message = e.StatusCode != null
? $"7TV returned HTTP {e.StatusCode}."
: e.Message;

logger.LogError($"{message} Some 7TV emotes may not be present for this session.");
}
catch (TaskCanceledException ex) when (ex.Message.Contains("HttpClient.Timeout"))
{
logger.LogError("7TV timed out. Some 7TV emotes may not be present for this session.");
}
}

Expand Down

0 comments on commit 1584c99

Please sign in to comment.