-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Python] TLV schema tag should start from 1 #12347
[Python] TLV schema tag should start from 1 #12347
Conversation
PR #12347: Size comparison from f50307a to 394c23b Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fast tracking given this is only updating testing tools for developers. Would be great to update this for CSG.
exceptions as needed in Matter modules to better debug issues that happen (like the one this PR is trying to solve). This is settable/clearable using the mattersetdebug() function. - Better format the exception object in the cluster object tests to return back useful information embedded in custom exception fields that can only be retrieved using str().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per discussions with @erjiaqing, I have come around to the approach of not throwing exceptions up to the user, but rather, returning the result as ValueDecodeFailure objects that in turn, contain the exception. This permits retrieving all attribute data without terminally failing the whole interaction on a single bad attribute.
However, this does make debugging issues more difficult. I've gone ahead and added a mattersetdebug()
function that has a global built-in enableDebugMode
variable that can be used to raise exceptions instead when trying to debug these failures. That will in turn, return the exception traceback which is needed to debug stuff.
Problem
TLV schema tag should start from 1, and the error is not captured.
Change overview
Update codegen, and add tests to verify if we successfully decoded all values.
Create
ValueDecodeFailure
class to wrap the value, since exceptions will be ignored in C callbacks.Wrap tests by _AssumeDecodeSuccess, users don't have to do this manually, they will see ValueDecodeFailure instead of the attribute describer.
Adds a new global debug mode variable that can be set using
mattersetdebug()
to facilitate debugging of issues (e.g throwing exceptions in the relevant modules instead of returning formatted ValueDecodeFailure objects).Testing
CI with first commit only should fail: https://github.com/erjiaqing/connectedhomeip/actions/runs/1519033903
CI with both commits should success.