Browse Source

Add missing exception handling. Fix #293

Former-commit-id: 3592ce3d67c70c1bd34ded26c48a0a3472ffd0d9
Former-commit-id: acb1420d8740919a329bba50d93c4f996e66f97d
Former-commit-id: 56dca60cbada6d0929f029b7a6a43570272bc5eb
pull/1/head
James Jackson-South 11 years ago
parent
commit
9bfcbe8f92
  1. 8
      src/ImageProcessorCore/ParallelImageProcessor.cs
  2. 1
      src/ImageProcessorCore/Samplers/Crop.cs

8
src/ImageProcessorCore/ParallelImageProcessor.cs

@ -34,6 +34,8 @@ namespace ImageProcessorCore
/// <inheritdoc/> /// <inheritdoc/>
public void Apply(ImageBase target, ImageBase source, Rectangle sourceRectangle) public void Apply(ImageBase target, ImageBase source, Rectangle sourceRectangle)
{
try
{ {
// We don't want to affect the original source pixels so we make clone here. // We don't want to affect the original source pixels so we make clone here.
ImageFrame frame = source as ImageFrame; ImageFrame frame = source as ImageFrame;
@ -71,6 +73,12 @@ namespace ImageProcessorCore
this.AfterApply(temp, target, target.Bounds, sourceRectangle); this.AfterApply(temp, target, target.Bounds, sourceRectangle);
} }
catch (Exception ex)
{
throw new ImageProcessingException($"An error occured when processing the image using {this.GetType().Name}. See the inner exception for more detail.", ex);
}
}
/// <inheritdoc/> /// <inheritdoc/>
public void Apply(ImageBase target, ImageBase source, int width, int height, Rectangle targetRectangle = default(Rectangle), Rectangle sourceRectangle = default(Rectangle)) public void Apply(ImageBase target, ImageBase source, int width, int height, Rectangle targetRectangle = default(Rectangle), Rectangle sourceRectangle = default(Rectangle))

1
src/ImageProcessorCore/Samplers/Crop.cs

@ -31,6 +31,7 @@ namespace ImageProcessorCore.Samplers
{ {
target[x, y] = source[x, y]; target[x, y] = source[x, y];
} }
this.OnRowProcessed(); this.OnRowProcessed();
} }
}); });

Loading…
Cancel
Save