diff options
| author | Shadowghost <Shadowghost@users.noreply.github.com> | 2026-11-20 07:23:42 -0500 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2026-11-20 07:23:42 -0500 |
| commit | 511f1ef882d594df64810d2c36b59ad381fd6e17 (patch) | |
| tree | 2a4dfabd381bbd23a1e1d65f9f9317c7deb659fb /MediaBrowser.Common/Net/HttpResponseBodyException.cs | |
| parent | 00d8050bf661f6f9050a8de6e55585a8fe6d8beb (diff) | |
Backport pull request #18048 from jellyfin/release-12.z
Follow the Schedules Direct API contract when refreshing the guide
Original-merge: 85fa90cb758dabfb434fbd00c1128091007cf6a4
Merged-by: Bond-009 <bond.009@outlook.com>
Backported-by: Cody Robibero <cody@robibe.ro>
Diffstat (limited to 'MediaBrowser.Common/Net/HttpResponseBodyException.cs')
| -rw-r--r-- | MediaBrowser.Common/Net/HttpResponseBodyException.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/MediaBrowser.Common/Net/HttpResponseBodyException.cs b/MediaBrowser.Common/Net/HttpResponseBodyException.cs new file mode 100644 index 0000000000..2194640b61 --- /dev/null +++ b/MediaBrowser.Common/Net/HttpResponseBodyException.cs @@ -0,0 +1,31 @@ +using System.Net; +using System.Net.Http; + +namespace MediaBrowser.Common.Net; + +/// <summary> +/// An <see cref="HttpRequestException"/> that retains the body of the failed response. +/// </summary> +/// <remarks> +/// Providers report why they refused a request in the response body, which +/// <see cref="HttpResponseMessage.EnsureSuccessStatusCode"/> discards. +/// </remarks> +public class HttpResponseBodyException : HttpRequestException +{ + /// <summary> + /// Initializes a new instance of the <see cref="HttpResponseBodyException"/> class. + /// </summary> + /// <param name="message">The exception message.</param> + /// <param name="statusCode">The status code of the failed response.</param> + /// <param name="responseBody">The body of the failed response.</param> + public HttpResponseBodyException(string message, HttpStatusCode? statusCode, string? responseBody) + : base(message, null, statusCode) + { + ResponseBody = responseBody; + } + + /// <summary> + /// Gets the body of the failed response. + /// </summary> + public string? ResponseBody { get; } +} |
