Skip to content

Commit

Permalink
Ignore invalid partslist entries (#1594)
Browse files Browse the repository at this point in the history
* Ignore invalid partslist entries

... instead of throwing

* And catch the error and log

* typo
  • Loading branch information
Apollon77 authored Dec 31, 2024
1 parent 689db45 commit 14ac774
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/matter.js/src/device/PairedNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ export class PairedNode {
readonly #updateEndpointStructureTimer = Time.getTimer(
"Endpoint structure update",
STRUCTURE_UPDATE_TIMEOUT_MS,
async () => await this.#updateEndpointStructure(),
() =>
this.#updateEndpointStructure().catch(error =>
logger.warn(`Node ${this.nodeId}: Error updating endpoint structure`, error),
),
);
#connectionState: NodeStates = NodeStates.Disconnected;
#reconnectionInProgress = false;
Expand Down Expand Up @@ -977,10 +980,10 @@ export class PairedNode {
const childEndpoint = this.#endpoints.get(childEndpointId);
const parentEndpoint = this.#endpoints.get(usages[0]);
if (childEndpoint === undefined || parentEndpoint === undefined) {
throw new InternalError(`Node ${this.nodeId}: Endpoint not found!`); // Should never happen!
}

if (parentEndpoint.getChildEndpoint(childEndpointId) === undefined) {
logger.warn(
`Node ${this.nodeId}: Endpoint ${usages[0]} not found in the data received from the device!`,
);
} else if (parentEndpoint.getChildEndpoint(childEndpointId) === undefined) {
logger.debug(
`Node ${this.nodeId}: Endpoint structure: Child: ${childEndpointId} -> Parent: ${parentEndpoint.number}`,
);
Expand Down

0 comments on commit 14ac774

Please sign in to comment.