Print failure info even if code_context is None #68
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.
Issue
I encountered a situation where code_context was None, which lead to a
TypeError: NoneType object is not subscriptable
error, which was not at all helpful in tracking down the problem. This fix allows the original error information to be printed anyway in that case.I admit I have not dug enough into this to know if it is reasonable that code_context might sometimes be None. Possibly this is a kluge, and there is a better fix.
Background
Some background in case anyone wants to dig further:
I encountered this while working on modm PR 676. The error came while running
python3 tools/scripts/docs_modm_io_generator.py -t -c -j4 -d
from the 'build-docs-test' CI job. Ultimately, it was because the LogicAnalyzer module intest/modm/mock/module.lb
was depending on thegpio_sampler
module, which was not available for the samg55 part I added. After applying the update in this PR, I got the error below, which was much more helpful than the NoneType message :).