Skip to content

convert/tech_subprocessor: contextual KeyErrors on unmapped IDs#1799

Open
nicolassanchez02 wants to merge 1 commit into
SFTtech:masterfrom
nicolassanchez02:feature/converter-key-error-context
Open

convert/tech_subprocessor: contextual KeyErrors on unmapped IDs#1799
nicolassanchez02 wants to merge 1 commit into
SFTtech:masterfrom
nicolassanchez02:feature/converter-key-error-context

Conversation

@nicolassanchez02
Copy link
Copy Markdown
Contributor

@nicolassanchez02 nicolassanchez02 commented May 28, 2026

Merge Checklist

Unmapped AoE2 attribute/resource ids throw a bare KeyError: 208, with nothing to say what 208 actually is. Wrapped the four upgrade_*_funcs[id] lookups in the AoC/DE2 tech subprocessors so the error names the category (e.g. "... civ resource: 208") and chains the original with raise ... from.

Just the spot from the issue plus the AoC parent.

Refs #1344.

@nicolassanchez02 nicolassanchez02 force-pushed the feature/converter-key-error-context branch 2 times, most recently from 3326033 to e98b5f9 Compare May 29, 2026 05:53
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.
@nicolassanchez02
Copy link
Copy Markdown
Contributor Author

The macOS-CI failure here isn't anything in this PR: configure aborts at find_package(Eigen3 3.3) rejecting the Eigen 5 the runner ships, before the build runs. That's the issue #1801 fixes. Once #1801 lands I'll rebase this onto master and the check goes green.

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.

1 participant