-
-
Notifications
You must be signed in to change notification settings - Fork 888
Change ImageFormatException to InvalidImageContentException #1190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
08b5c4c
48964fb
b9a5c92
08de04b
193dafe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,9 +38,10 @@ public Image<TPixel> Decode<TPixel>(Configuration configuration, Stream stream) | |
| { | ||
| Size dims = decoder.Dimensions; | ||
|
|
||
| // TODO: use InvalidImageContentException here, if we decide to define it | ||
| // https://github.com/SixLabors/ImageSharp/issues/1110 | ||
| throw new ImageFormatException($"Can not decode image. Failed to allocate buffers for possibly degenerate dimensions: {dims.Width}x{dims.Height}.", ex); | ||
| GifThrowHelper.ThrowInvalidImageContentException($"Can not decode image. Failed to allocate buffers for possibly degenerate dimensions: {dims.Width}x{dims.Height}.", ex); | ||
|
|
||
| // Not reachable, as the previous statement will throw a exception. | ||
| return null; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JimBobSquarePants is there a way to annotate a method, that it will always throw to avoid this return statement? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately not. There's something coming in NET5 I believe but it won't be backwards compatible. |
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move these and others to the
ThrowHelperclasses for each format please. That's why I missed them.