diff --git a/src/ImageProcessor/Processors/AutoRotate.cs b/src/ImageProcessor/Processors/AutoRotate.cs index 251ba308b..521d0c2e9 100644 --- a/src/ImageProcessor/Processors/AutoRotate.cs +++ b/src/ImageProcessor/Processors/AutoRotate.cs @@ -11,8 +11,11 @@ namespace ImageProcessor.Processors { + using System; using System.Collections.Generic; using System.Drawing; + + using ImageProcessor.Core.Common.Exceptions; using ImageProcessor.Imaging; /// @@ -93,7 +96,11 @@ namespace ImageProcessor.Processors image = newImage; } } - catch + catch (Exception ex) + { + throw new ImageProcessingException("Error processing image with " + this.GetType().Name, ex); + } + finally { if (newImage != null) { diff --git a/src/ImageProcessor/Processors/BackgroundColor.cs b/src/ImageProcessor/Processors/BackgroundColor.cs index b6d97eb19..8ba8bf2a2 100644 --- a/src/ImageProcessor/Processors/BackgroundColor.cs +++ b/src/ImageProcessor/Processors/BackgroundColor.cs @@ -10,9 +10,12 @@ namespace ImageProcessor.Processors { + using System; using System.Collections.Generic; using System.Drawing; + using ImageProcessor.Core.Common.Exceptions; + /// /// Changes the background color of an image. /// @@ -68,7 +71,11 @@ namespace ImageProcessor.Processors image.Dispose(); image = newImage; } - catch + catch (Exception ex) + { + throw new ImageProcessingException("Error processing image with " + this.GetType().Name, ex); + } + finally { if (newImage != null) { diff --git a/src/ImageProcessor/Processors/Format.cs b/src/ImageProcessor/Processors/Format.cs index 921b5c939..2f67ad71a 100644 --- a/src/ImageProcessor/Processors/Format.cs +++ b/src/ImageProcessor/Processors/Format.cs @@ -10,8 +10,11 @@ namespace ImageProcessor.Processors { + using System; using System.Collections.Generic; using System.Drawing; + + using ImageProcessor.Core.Common.Exceptions; using ImageProcessor.Imaging.Formats; /// @@ -57,8 +60,16 @@ namespace ImageProcessor.Processors /// public Image ProcessImage(ImageFactory factory) { - ISupportedImageFormat format = this.DynamicParameter; - factory.Format(format); + try + { + ISupportedImageFormat format = this.DynamicParameter; + factory.Format(format); + } + catch (Exception ex) + { + throw new ImageProcessingException("Error processing image with " + this.GetType().Name, ex); + } + return factory.Image; } } diff --git a/src/ImageProcessor/Processors/Quality.cs b/src/ImageProcessor/Processors/Quality.cs index bb89a3e6b..28bb445fb 100644 --- a/src/ImageProcessor/Processors/Quality.cs +++ b/src/ImageProcessor/Processors/Quality.cs @@ -11,8 +11,13 @@ namespace ImageProcessor.Processors { #region Using + + using System; using System.Collections.Generic; using System.Drawing; + + using ImageProcessor.Core.Common.Exceptions; + #endregion /// @@ -58,7 +63,15 @@ namespace ImageProcessor.Processors /// public Image ProcessImage(ImageFactory factory) { - factory.CurrentImageFormat.Quality = this.DynamicParameter; + try + { + factory.CurrentImageFormat.Quality = this.DynamicParameter; + } + catch (Exception ex) + { + throw new ImageProcessingException("Error processing image with " + this.GetType().Name, ex); + } + return factory.Image; } } diff --git a/src/ImageProcessor/Processors/Watermark.cs b/src/ImageProcessor/Processors/Watermark.cs index b0ff1e00d..d6e9a97fe 100644 --- a/src/ImageProcessor/Processors/Watermark.cs +++ b/src/ImageProcessor/Processors/Watermark.cs @@ -180,4 +180,4 @@ namespace ImageProcessor.Processors } } } -} +} \ No newline at end of file