-
-
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1190 +/- ##
==========================================
- Coverage 82.55% 82.54% -0.01%
==========================================
Files 692 692
Lines 29976 29986 +10
Branches 3388 3388
==========================================
+ Hits 24746 24752 +6
- Misses 4533 4537 +4
Partials 697 697
Continue to review full report at Codecov.
|
| // 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}. This error can happen for very large RLE bitmaps, which are not supported.", ex); | ||
| throw new InvalidImageContentException($"Can not decode image. Failed to allocate buffers for possibly degenerate dimensions: {dims.Width}x{dims.Height}. This error can happen for very large RLE bitmaps, which are not supported.", ex); |
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 ThrowHelper classes for each format please. That's why I missed them.
| 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 comment
The 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 comment
The 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.
Prerequisites
Description
Change a few exceptions to
InvalidImageContentExceptionwhich were missed in #1179