Forráskód Böngészése

remove custom HttpException

crobibero 4 éve
szülő
commit
95a2de757f

+ 2 - 1
Emby.Server.Implementations/Library/LibraryManager.cs

@@ -6,6 +6,7 @@ using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Net;
 using System.Net;
+using System.Net.Http;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Emby.Naming.Audio;
 using Emby.Naming.Audio;
@@ -2907,7 +2908,7 @@ namespace Emby.Server.Implementations.Library
 
 
                     return item.GetImageInfo(image.Type, imageIndex);
                     return item.GetImageInfo(image.Type, imageIndex);
                 }
                 }
-                catch (HttpException ex)
+                catch (HttpRequestException ex)
                 {
                 {
                     if (ex.StatusCode.HasValue
                     if (ex.StatusCode.HasValue
                         && (ex.StatusCode.Value == HttpStatusCode.NotFound || ex.StatusCode.Value == HttpStatusCode.Forbidden))
                         && (ex.StatusCode.Value == HttpStatusCode.NotFound || ex.StatusCode.Value == HttpStatusCode.Forbidden))

+ 3 - 3
Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs

@@ -591,7 +591,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
                 savedToken.Value = DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture);
                 savedToken.Value = DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture);
                 return result;
                 return result;
             }
             }
-            catch (HttpException ex)
+            catch (HttpRequestException ex)
             {
             {
                 if (ex.StatusCode.HasValue)
                 if (ex.StatusCode.HasValue)
                 {
                 {
@@ -621,7 +621,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
             {
             {
                 return await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, completionOption, cancellationToken).ConfigureAwait(false);
                 return await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, completionOption, cancellationToken).ConfigureAwait(false);
             }
             }
-            catch (HttpException ex)
+            catch (HttpRequestException ex)
             {
             {
                 _tokens.Clear();
                 _tokens.Clear();
 
 
@@ -711,7 +711,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
 
 
                 return root.lineups.Any(i => string.Equals(info.ListingsId, i.lineup, StringComparison.OrdinalIgnoreCase));
                 return root.lineups.Any(i => string.Equals(info.ListingsId, i.lineup, StringComparison.OrdinalIgnoreCase));
             }
             }
-            catch (HttpException ex)
+            catch (HttpRequestException ex)
             {
             {
                 // Apparently we're supposed to swallow this
                 // Apparently we're supposed to swallow this
                 if (ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.BadRequest)
                 if (ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.BadRequest)

+ 2 - 2
Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs

@@ -143,7 +143,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
 
 
                 return discoverResponse;
                 return discoverResponse;
             }
             }
-            catch (HttpException ex)
+            catch (HttpRequestException ex)
             {
             {
                 if (!throwAllExceptions && ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.NotFound)
                 if (!throwAllExceptions && ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.NotFound)
                 {
                 {
@@ -663,7 +663,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
                 var modelInfo = await GetModelInfo(info, true, CancellationToken.None).ConfigureAwait(false);
                 var modelInfo = await GetModelInfo(info, true, CancellationToken.None).ConfigureAwait(false);
                 info.DeviceId = modelInfo.DeviceID;
                 info.DeviceId = modelInfo.DeviceID;
             }
             }
-            catch (HttpException ex)
+            catch (HttpRequestException ex)
             {
             {
                 if (ex.StatusCode.HasValue && ex.StatusCode.Value == System.Net.HttpStatusCode.NotFound)
                 if (ex.StatusCode.HasValue && ex.StatusCode.Value == System.Net.HttpStatusCode.NotFound)
                 {
                 {

+ 2 - 1
Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs

@@ -4,6 +4,7 @@ using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
+using System.Net.Http;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using MediaBrowser.Common.Updates;
 using MediaBrowser.Common.Updates;
@@ -101,7 +102,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
                         throw;
                         throw;
                     }
                     }
                 }
                 }
-                catch (HttpException ex)
+                catch (HttpRequestException ex)
                 {
                 {
                     _logger.LogError(ex, "Error downloading {0}", package.Name);
                     _logger.LogError(ex, "Error downloading {0}", package.Name);
                 }
                 }

+ 0 - 5
Emby.Server.Implementations/Updates/InstallationManager.cs

@@ -116,11 +116,6 @@ namespace Emby.Server.Implementations.Updates
                 _logger.LogError(ex, "The URL configured for the plugin repository manifest URL is not valid: {Manifest}", manifest);
                 _logger.LogError(ex, "The URL configured for the plugin repository manifest URL is not valid: {Manifest}", manifest);
                 return Array.Empty<PackageInfo>();
                 return Array.Empty<PackageInfo>();
             }
             }
-            catch (HttpException ex)
-            {
-                _logger.LogError(ex, "An error occurred while accessing the plugin manifest: {Manifest}", manifest);
-                return Array.Empty<PackageInfo>();
-            }
             catch (HttpRequestException ex)
             catch (HttpRequestException ex)
             {
             {
                 _logger.LogError(ex, "An error occurred while accessing the plugin manifest: {Manifest}", manifest);
                 _logger.LogError(ex, "An error occurred while accessing the plugin manifest: {Manifest}", manifest);

+ 0 - 42
MediaBrowser.Model/Net/HttpException.cs

@@ -1,42 +0,0 @@
-using System;
-using System.Net;
-
-namespace MediaBrowser.Model.Net
-{
-    /// <summary>
-    /// Class HttpException.
-    /// </summary>
-    public class HttpException : Exception
-    {
-        /// <summary>
-        /// Gets or sets the status code.
-        /// </summary>
-        /// <value>The status code.</value>
-        public HttpStatusCode? StatusCode { get; set; }
-
-        /// <summary>
-        /// Gets or sets a value indicating whether this instance is timed out.
-        /// </summary>
-        /// <value><c>true</c> if this instance is timed out; otherwise, <c>false</c>.</value>
-        public bool IsTimedOut { get; set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="HttpException" /> class.
-        /// </summary>
-        /// <param name="message">The message.</param>
-        /// <param name="innerException">The inner exception.</param>
-        public HttpException(string message, Exception innerException)
-            : base(message, innerException)
-        {
-        }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="HttpException" /> class.
-        /// </summary>
-        /// <param name="message">The message.</param>
-        public HttpException(string message)
-            : base(message)
-        {
-        }
-    }
-}

+ 3 - 2
MediaBrowser.Providers/Manager/ItemImageProvider.cs

@@ -5,6 +5,7 @@ using System.Collections.Generic;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Net;
 using System.Net;
+using System.Net.Http;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
@@ -481,7 +482,7 @@ namespace MediaBrowser.Providers.Manager
                     result.UpdateType |= ItemUpdateType.ImageUpdate;
                     result.UpdateType |= ItemUpdateType.ImageUpdate;
                     return true;
                     return true;
                 }
                 }
-                catch (HttpException ex)
+                catch (HttpRequestException ex)
                 {
                 {
                     // Sometimes providers send back bad url's. Just move to the next image
                     // Sometimes providers send back bad url's. Just move to the next image
                     if (ex.StatusCode.HasValue
                     if (ex.StatusCode.HasValue
@@ -595,7 +596,7 @@ namespace MediaBrowser.Providers.Manager
                         cancellationToken).ConfigureAwait(false);
                         cancellationToken).ConfigureAwait(false);
                     result.UpdateType = result.UpdateType | ItemUpdateType.ImageUpdate;
                     result.UpdateType = result.UpdateType | ItemUpdateType.ImageUpdate;
                 }
                 }
-                catch (HttpException ex)
+                catch (HttpRequestException ex)
                 {
                 {
                     // Sometimes providers send back bad urls. Just move onto the next image
                     // Sometimes providers send back bad urls. Just move onto the next image
                     if (ex.StatusCode.HasValue
                     if (ex.StatusCode.HasValue

+ 2 - 8
MediaBrowser.Providers/Manager/ProviderManager.cs

@@ -160,10 +160,7 @@ namespace MediaBrowser.Providers.Manager
 
 
             if (response.StatusCode != HttpStatusCode.OK)
             if (response.StatusCode != HttpStatusCode.OK)
             {
             {
-                throw new HttpException("Invalid image received.")
-                {
-                    StatusCode = response.StatusCode
-                };
+                throw new HttpRequestException("Invalid image received.", null, response.StatusCode);
             }
             }
 
 
             var contentType = response.Content.Headers.ContentType.MediaType;
             var contentType = response.Content.Headers.ContentType.MediaType;
@@ -181,10 +178,7 @@ namespace MediaBrowser.Providers.Manager
             // thetvdb will sometimes serve a rubbish 404 html page with a 200 OK code, because reasons...
             // thetvdb will sometimes serve a rubbish 404 html page with a 200 OK code, because reasons...
             if (contentType.Equals(MediaTypeNames.Text.Html, StringComparison.OrdinalIgnoreCase))
             if (contentType.Equals(MediaTypeNames.Text.Html, StringComparison.OrdinalIgnoreCase))
             {
             {
-                throw new HttpException("Invalid image received.")
-                {
-                    StatusCode = HttpStatusCode.NotFound
-                };
+                throw new HttpRequestException("Invalid image received.", null, HttpStatusCode.NotFound);
             }
             }
 
 
             await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
             await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);