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

Print failure info even if code_context is None #68

Merged
merged 1 commit into from
Sep 8, 2021

Conversation

mcbridejc
Copy link
Contributor

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 in test/modm/mock/module.lb was depending on the gpio_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 :).

Error generating documentation for device samg55j19a-mu: Cannot resolve dependency ':driver:gpio_sampler' of Module(modm-test:mock:logic_analyzer)!
In file 'modm-samg/demo/ext/modm/test/modm/mock/module.lb:96' in function 'prepare':
    def prepare(self, module, options):

Copy link
Member

@salkinium salkinium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is fantastic!

@salkinium salkinium force-pushed the fix/handle-code-context-none branch from 27b4ed1 to 69f797d Compare September 8, 2021 18:37
@salkinium salkinium merged commit 69f797d into modm-io:develop Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants