From f42715548089e9fe294ba3c2ea6525b22fbd21db Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 21 Nov 2019 19:39:30 +1100 Subject: [PATCH] Removes unused exceptions --- .../Exceptions/ConnectionException.cs | 45 ------------------- .../Migrations/DataLossException.cs | 45 ------------------- .../Services/Implement/PackagingService.cs | 2 +- src/Umbraco.Core/Umbraco.Core.csproj | 4 +- src/Umbraco.Web/Media/Exif/ExifExceptions.cs | 40 ----------------- .../Media/Exif/ExifExtendedProperty.cs | 2 +- src/Umbraco.Web/Media/Exif/JPEGExceptions.cs | 40 ----------------- 7 files changed, 3 insertions(+), 175 deletions(-) delete mode 100644 src/Umbraco.Core/Exceptions/ConnectionException.cs delete mode 100644 src/Umbraco.Core/Migrations/DataLossException.cs diff --git a/src/Umbraco.Core/Exceptions/ConnectionException.cs b/src/Umbraco.Core/Exceptions/ConnectionException.cs deleted file mode 100644 index 517d0633a0..0000000000 --- a/src/Umbraco.Core/Exceptions/ConnectionException.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Umbraco.Core.Exceptions -{ - /// - /// The exception that is thrown when a connection fails. - /// - /// - [Serializable] - internal class ConnectionException : Exception - { - /// - /// Initializes a new instance of the class. - /// - public ConnectionException() - { } - - /// - /// Initializes a new instance of the class. - /// - /// The message that describes the error. - public ConnectionException(string message) - : base(message) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified. - public ConnectionException(string message, Exception innerException) - : base(message, innerException) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected ConnectionException(SerializationInfo info, StreamingContext context) - : base(info, context) - { } - } -} diff --git a/src/Umbraco.Core/Migrations/DataLossException.cs b/src/Umbraco.Core/Migrations/DataLossException.cs deleted file mode 100644 index 1ba10bce62..0000000000 --- a/src/Umbraco.Core/Migrations/DataLossException.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Umbraco.Core.Migrations -{ - /// - /// The exception that is thrown if a migration has executed, but the whole process has failed and cannot be rolled back. - /// - /// - [Serializable] - internal class DataLossException : Exception - { - /// - /// Initializes a new instance of the class. - /// - public DataLossException() - { } - - /// - /// Initializes a new instance of the class. - /// - /// The message that describes the error. - public DataLossException(string message) - : base(message) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The error message that explains the reason for the exception. - /// The inner exception. - public DataLossException(string message, Exception innerException) - : base(message, innerException) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected DataLossException(SerializationInfo info, StreamingContext context) - : base(info, context) - { } - } -} diff --git a/src/Umbraco.Core/Services/Implement/PackagingService.cs b/src/Umbraco.Core/Services/Implement/PackagingService.cs index b4dcc70a96..d85c688a0d 100644 --- a/src/Umbraco.Core/Services/Implement/PackagingService.cs +++ b/src/Umbraco.Core/Services/Implement/PackagingService.cs @@ -57,7 +57,7 @@ namespace Umbraco.Core.Services.Implement } catch (HttpRequestException ex) { - throw new ConnectionException("An error occurring downloading the package from " + url, ex); + throw new HttpRequestException("An error occurring downloading the package from " + url, ex); } //successful diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index d6b63880d6..6a0a77794e 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -680,7 +680,6 @@ - @@ -1065,7 +1064,6 @@ - @@ -1572,4 +1570,4 @@ - + \ No newline at end of file diff --git a/src/Umbraco.Web/Media/Exif/ExifExceptions.cs b/src/Umbraco.Web/Media/Exif/ExifExceptions.cs index 976fb849ed..3d2ce61e9e 100644 --- a/src/Umbraco.Web/Media/Exif/ExifExceptions.cs +++ b/src/Umbraco.Web/Media/Exif/ExifExceptions.cs @@ -44,44 +44,4 @@ namespace Umbraco.Web.Media.Exif { } } - /// - /// The exception that is thrown when an invalid enum type is given to an ExifEnumProperty. - /// - /// - [Serializable] - internal class UnknownEnumTypeException : Exception - { - /// - /// Initializes a new instance of the class. - /// - public UnknownEnumTypeException() - : base("Unknown enum type.") - { } - - /// - /// Initializes a new instance of the class. - /// - /// The message that describes the error. - public UnknownEnumTypeException(string message) - : base(message) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified. - public UnknownEnumTypeException(string message, Exception innerException) - : base(message, innerException) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected UnknownEnumTypeException(SerializationInfo info, StreamingContext context) - : base(info, context) - { } - } } diff --git a/src/Umbraco.Web/Media/Exif/ExifExtendedProperty.cs b/src/Umbraco.Web/Media/Exif/ExifExtendedProperty.cs index 40ba275fe4..63c1ce3365 100644 --- a/src/Umbraco.Web/Media/Exif/ExifExtendedProperty.cs +++ b/src/Umbraco.Web/Media/Exif/ExifExtendedProperty.cs @@ -64,7 +64,7 @@ namespace Umbraco.Web.Media.Exif return new ExifInterOperability(tagid, 3, 1, ExifBitConverter.GetBytes((ushort)((object)mValue), BitConverterEx.SystemByteOrder, BitConverterEx.SystemByteOrder)); } else - throw new UnknownEnumTypeException(); + throw new InvalidOperationException($"An invalid enum type ({basetype.FullName}) was provided for type {type.FullName}"); } } } diff --git a/src/Umbraco.Web/Media/Exif/JPEGExceptions.cs b/src/Umbraco.Web/Media/Exif/JPEGExceptions.cs index f23dbeb4d4..40fd9f3be8 100644 --- a/src/Umbraco.Web/Media/Exif/JPEGExceptions.cs +++ b/src/Umbraco.Web/Media/Exif/JPEGExceptions.cs @@ -4,46 +4,6 @@ using System.Runtime.Serialization; namespace Umbraco.Web.Media.Exif { - /// - /// The exception that is thrown when the format of the image file could not be understood. - /// - /// - [Serializable] - internal class NotValidImageFileException : Exception - { - /// - /// Initializes a new instance of the class. - /// - public NotValidImageFileException() - : base("Not a valid image file.") - { } - - /// - /// Initializes a new instance of the class. - /// - /// The message that describes the error. - public NotValidImageFileException(string message) - : base(message) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified. - public NotValidImageFileException(string message, Exception innerException) - : base(message, innerException) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected NotValidImageFileException(SerializationInfo info, StreamingContext context) - : base(info, context) - { } - } /// /// The exception that is thrown when the format of the JPEG file could not be understood.