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

Log parsing errors to stderr #18

Open
chrsoo opened this issue Jan 24, 2025 · 1 comment
Open

Log parsing errors to stderr #18

chrsoo opened this issue Jan 24, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@chrsoo
Copy link
Contributor

chrsoo commented Jan 24, 2025

Hi,

Troubleshooting file parsing can be rather difficult and sometimes it is reasonable accept errors when parsing with the higher goal of being able to read the file at all. I think as a principle the API should be lenient while reading and strict while writing.

All the same, it would be useful to output errors found while parsing to stderr and the structured way to do this is to use a logging API.

Should we introduce log and start logging parsing errors and other events?

Impact is minimal and the API user can chose how to output messages with a multitude of log implementations. For development of fitsrs we should probably use e.g. test-log to get the relevant output in unit tests.

@chrsoo
Copy link
Contributor Author

chrsoo commented Jan 24, 2025

An example of the actual need is that one of the test files is missing a closing single quote for a string.

PR #16 treats this as Card::Undefined and gets on with the work, but it would be better if we reported the issue on stderr.

This way the issue becomes visible and there is an impetus to improve the fitsrs parsing if the value actually should be considered valid, or perhaps to ask the producer of the file to fix it, if it really is an error in the source file.

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

No branches or pull requests

2 participants