convert/tech_subprocessor: contextual KeyErrors on unmapped IDs#1799
Open
nicolassanchez02 wants to merge 1 commit into
Open
convert/tech_subprocessor: contextual KeyErrors on unmapped IDs#1799nicolassanchez02 wants to merge 1 commit into
nicolassanchez02 wants to merge 1 commit into
Conversation
3 tasks
3326033 to
e98b5f9
Compare
When the converter hits an AoE2 attribute or resource ID that hasn't been mapped to an openage API property, the lookup raises a bare "KeyError: 208" with no hint of what 208 means. Triaging those reports takes a full trace read just to figure out whether the missing mapping is an attribute, a resource, or DE2-specific. Wrap the four upgrade_*_funcs[id] lookups in AoC and DE2 tech_subprocessor with try/except + raise from, so the message names the category (attribute vs resource, AoC vs DE2) and preserves the original KeyError for the trace. Same pattern can be applied to the other dict-by-ID lookups in the converter; this PR is just the spot called out in the issue plus its direct AoC parent, to establish the pattern. Happy to extend the sweep if maintainers prefer one big PR. Refs SFTtech#1344.
e98b5f9 to
e286c85
Compare
3 tasks
Contributor
Author
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.
Merge Checklist
make checkmergeUnmapped AoE2 attribute/resource ids throw a bare
KeyError: 208, with nothing to say what 208 actually is. Wrapped the fourupgrade_*_funcs[id]lookups in the AoC/DE2 tech subprocessors so the error names the category (e.g. "... civ resource: 208") and chains the original withraise ... from.Just the spot from the issue plus the AoC parent.
Refs #1344.