Skip to content
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

Small improvement: Adjust error messages. #2172

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Landay7
Copy link

@Landay7 Landay7 commented Mar 18, 2024

Hello, thank you for your project.
I use it to work with ico files and sometimes error messages don't provide me with full information, which can help.
So, I tried to improve it a bit and add additional information.

I license past and future contributions under the dual MIT/Apache-2.0 license,
allowing licensees to choose either at their option.

@Landay7 Landay7 changed the title Improve error messages Small improvement: Adjust error messages. Mar 18, 2024
DecoderError::PngShorterThanHeader => {
f.write_str("Entry specified a length that is shorter than PNG header!")
DecoderError::IcoEntryTooManyPlanesOrHotspot(num_color_planes) => {
f.write_fmt(format_args!("ICO image entry specifies {}, which exceeds the allowed number of color planes or has an invalid hotspot value", num_color_planes))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message is unclear whether the number indicated is how many planes are in the image, or how many hotspots are

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.
I tried to improve it.
Now users at least can know, depending on which file he or she works on.

@fintelia
Copy link
Contributor

fintelia commented Apr 5, 2024

I'm not very familiar with ICO files. Is there a reason we can't say whether the field is a color planes count or a hotspots count?

@Landay7
Copy link
Author

Landay7 commented Apr 12, 2024

We can by using _type
(It will 1 for ICO or 2 for CUR, other values will be invalid). Reference
I can try to improve PR checking the type and improve check and error message correspondingly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants