python-matter-server icon indicating copy to clipboard operation
python-matter-server copied to clipboard

Provide underlying errors back to client

Open olavt opened this issue 1 year ago • 1 comments

It would be nice if more details on the error would be provided back to the client.

Take this example:

info: MatterServerAdmin.Program[0] MatterServerClient.SendCommandAsync: Sending command: { "message_id": "3", "command": "commission_with_code", "args": { "code": "34970112332" } } info: MatterServerAdmin.Program[0] MatterServerClient.ReceiveFromWebSocket: 98 bytes received. info: MatterServerAdmin.Program[0] Received response: { "message_id": "3", "error_code": 1, "details": "Commission with code failed for node 1." }

From the Matter Server logs:

2024-05-30 09:28:10.390 (MainThread) INFO [matter_server.server.device_controller] Starting Matter commissioning with code using Node ID 1 (attempt 1/3). 2024-05-30 09:28:13.312 (Dummy-2) INFO [root] Established secure session with Device 2024-05-30 09:28:14.890 (Dummy-2) CHIP_ERROR [chip.native.CTL] Failed in verifying 'Attestation Information' command received from the device: err 101. Look at AttestationVerificationResult enum to understand the errors 2024-05-30 09:28:14.892 (Dummy-2) CHIP_ERROR [chip.native.CTL] Error on commissioning step 'AttestationVerification': 'src/controller/CHIPDeviceController.cpp:1145: CHIP Error 0x000000AC: Internal error' 2024-05-30 09:28:17.019 (Dummy-2) WARNING [root] Failed to commission: src/controller/CHIPDeviceController.cpp:1145: CHIP Error 0x000000AC: Internal error

It would be nice if the details on the error could be sent to back to the client and not just a generic "Commission with code failed for node 1".

olavt avatar May 31 '24 06:05 olavt

This is an area of our interest - we want to map more SDK errors to specific errors. Not always we get back a specific error from the SDK unfortunately so this a painful process of slowly patching upstream etc. For our own application (Home Assistant) it would also be very helpful to tell the user more precisely what failed.

Its on the radar but so many others things as well ;-)

marcelveldt avatar May 31 '24 11:05 marcelveldt