feat: Add error output to suggest possible causes when scenario parsing fails#454
Open
b-s-code wants to merge 2 commits intoOpenMalaria-Org:mainfrom
Open
feat: Add error output to suggest possible causes when scenario parsing fails#454b-s-code wants to merge 2 commits intoOpenMalaria-Org:mainfrom
b-s-code wants to merge 2 commits intoOpenMalaria-Org:mainfrom
Conversation
Collaborator
Author
|
@acavelan may I please get a review? @melissapenny @nakul7 FYI |
Collaborator
|
This is a really good idea. It would be even better if we could detect that the file does not exist before trying to parse the document. I believe users get confused because they get 300 lines of errors when this happens. They will probably miss the new helper text at the top. If not possible, perhaps the new error description should appear at the end? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A misplaced/misnamed/unlocatable XSD file is not easily identified by new users, from existing OpenMalaria stderr output.
This is a mostly a quality of life issue, where very experienced OpenMalaria users can generally infer the nature of the issue from existing stderr output contents. But only because they've already spent the time to learn what the symptoms mean.
Solution
Much of the code that gets called when parsing the scenario is generated (by xsdcxx) C++ code.
To avoid getting too involved with such generated code, I looked at what could be done in relevant code within OpenMalaria's source tree.
The solution presented in this PR is to simply print additional output to stderr when parsing fails, suggesting 2 possible causes to the user.
A notable limitation of this PR is it does not check the 2 suggested possible causes in order to determine which if any of them are actually responsible.
Testing
I tested before/after for 3 cases:
Scenario conforms to schema, schema is appropriately named/located.
This is the happy path. No change in output occurs.
Scenario conforms to schema, schema is wrongly named/located.
Before:
After:
Scenario does not conform to schema, schema is appropriately named/located.
(For this test case, I used 48.0 schema, instead of scenario_current.xsd.)
Before:
After:
Documentation
No wiki updates or other documentation changes needed for this PR.