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

KeyError in _classify_pandoc_logging when the message format does not fit the assumptions #269

Closed
massoncl opened this issue Apr 22, 2022 · 2 comments · Fixed by #271 or #272
Closed
Milestone

Comments

@massoncl
Copy link

Since #250, I have an issue with the _classify_pandoc_logging function : when the parsed message does not fit the expected format, the parsing can end in a KeyError. For example, pandoc-include has a warning formatted like this:

[Warn] included file not found: path_of_the_file

Warn isn't in the dictionnary of expected log levels, which raises a KeyError on line 422:

yield level_map[level], "\n".join(log_msgs)
@JessicaTegner
Copy link
Owner

hi @massoncl
thanks for catching this.

Which one would you say would be the prefered solution:

  • Just spith it out, and if so on what level.
  • Try to classify these extra messages (more messages like this might pop up in the future)

@massoncl
Copy link
Author

I'm not very familiar with this codebase, but I'd say both solutions can be implemented: a classification that tries to include all the message types you're aware of, with an additional fallback case to handle new cases. In the fallback, I'd say that re-logging the messages as "warning" would be best.

@JessicaTegner JessicaTegner added this to the 1.8 milestone May 2, 2022
JessicaTegner pushed a commit that referenced this issue May 3, 2022
Added logic for if classify_pandoc_logging can't identify the correct logging level (#271)

* Added test logic for invalid log levels

* Now falling back to default log level, if classify can't identify the correct level
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants