Log SchedulesDirect response on request error

pull/10847/head
Patrick Barron 4 months ago
parent f87a5490ad
commit 604f4b2742

@ -608,6 +608,11 @@ namespace Jellyfin.LiveTv.Listings
if (!enableRetry || (int)response.StatusCode >= 500) 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( throw new HttpRequestException(
string.Format(CultureInfo.InvariantCulture, "Request failed: {0}", response.ReasonPhrase), string.Format(CultureInfo.InvariantCulture, "Request failed: {0}", response.ReasonPhrase),
null, null,
@ -655,11 +660,22 @@ namespace Jellyfin.LiveTv.Listings
ArgumentException.ThrowIfNullOrEmpty(token); ArgumentException.ThrowIfNullOrEmpty(token);
ArgumentException.ThrowIfNullOrEmpty(info.ListingsId); 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); using var message = new HttpRequestMessage(HttpMethod.Put, ApiUrl + "/lineups/" + info.ListingsId);
options.Headers.TryAddWithoutValidation("token", token); message.Headers.TryAddWithoutValidation("token", token);
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
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) private async Task<bool> HasLineup(ListingsProviderInfo info, CancellationToken cancellationToken)

Loading…
Cancel
Save