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

[Python] Fix schema not found error on vendor specific data #26120

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/controller/python/chip/clusters/Attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __init__(self, ClusterType: Cluster = None, AttributeType: ClusterAttributeD
break

if (self.ClusterType is None or self.AttributeType is None):
raise Exception("Schema not found")
raise KeyError(f"No Schema found for Attribute {Path}")

# Next, let's figure out the label.
for field in self.ClusterType.descriptor.Fields:
Expand All @@ -156,7 +156,7 @@ def __init__(self, ClusterType: Cluster = None, AttributeType: ClusterAttributeD
self.AttributeName = field.Label

if (self.AttributeName is None):
raise Exception("Schema not found")
raise KeyError(f"Unable to resolve name for Attribute {Path}")

self.Path = Path
self.ClusterId = self.ClusterType.id
Expand Down Expand Up @@ -745,8 +745,14 @@ def _handleReportEnd(self):

if (self._subscription_handler is not None):
for change in self._changedPathSet:
try:
attribute_path = TypedAttributePath(Path=change)
except (KeyError, ValueError) as err:
# path could not be resolved into a TypedAttributePath
logging.getLogger(__name__).exception(err)
continue
self._subscription_handler.OnAttributeChangeCb(
TypedAttributePath(Path=change), self._subscription_handler)
attribute_path, self._subscription_handler)

# Clear it out once we've notified of all changes in this transaction.
self._changedPathSet = set()
Expand Down