aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2024-01-24 11:17:45 -0500
committerPatrick Barron <barronpm@gmail.com>2024-01-25 09:33:06 -0500
commit604f4b2742416abf3149e95d8168b538ecb8b5f1 (patch)
treef5e581b0c4aebd4b3915efef6baeffc8fa67c669 /src
parentf87a5490adce83c32362a14518d6f6e3e5a24917 (diff)
Log SchedulesDirect response on request error
Diffstat (limited to 'src')
-rw-r--r--src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs b/src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs
index 5728146f7..eaf5495c7 100644
--- a/src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs
+++ b/src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs
@@ -608,6 +608,11 @@ namespace Jellyfin.LiveTv.Listings
if (!enableRetry || (int)response.StatusCode >= 500)
{
+ _logger.LogError(
+ "Request to {Url} failed with response {Response}",
+ message.RequestUri,
+ await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false));
+
throw new HttpRequestException(
string.Format(CultureInfo.InvariantCulture, "Request failed: {0}", response.ReasonPhrase),
null,
@@ -655,11 +660,22 @@ namespace Jellyfin.LiveTv.Listings
ArgumentException.ThrowIfNullOrEmpty(token);
ArgumentException.ThrowIfNullOrEmpty(info.ListingsId);
- _logger.LogInformation("Adding new LineUp ");
+ _logger.LogInformation("Adding new lineup {Id}", info.ListingsId);
- using var options = new HttpRequestMessage(HttpMethod.Put, ApiUrl + "/lineups/" + info.ListingsId);
- options.Headers.TryAddWithoutValidation("token", token);
- using var response = await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+ using var message = new HttpRequestMessage(HttpMethod.Put, ApiUrl + "/lineups/" + info.ListingsId);
+ message.Headers.TryAddWithoutValidation("token", token);
+
+ using var client = _httpClientFactory.CreateClient(NamedClient.Default);
+ using var response = await client
+ .SendAsync(message, HttpCompletionOption.ResponseHeadersRead, cancellationToken)
+ .ConfigureAwait(false);
+
+ if (!response.IsSuccessStatusCode)
+ {
+ _logger.LogError(
+ "Error adding lineup to account: {Response}",
+ await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false));
+ }
}
private async Task<bool> HasLineup(ListingsProviderInfo info, CancellationToken cancellationToken)