CESARBR / CESARBR/knot-cloud-protocol-adapter-websocket
Show thing ID on error when it hasn't schema for a sensor on setData command
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
The error is now returned as follows:
```
{ Error: The thing undefined has no schema for sensor id 1
at Client.onMessage (/Users/jneto/workspace/knot/cloud/knot-cloud/node_modules/@cesarbr/knot-cloud-websocket/dist/main.js:1392:23)
at WebSocket.onMessage (/Users/jneto/workspace/knot/cloud/knot-cloud/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (/Users/jneto/workspace/knot/cloud/knot-cloud/node_modules/ws/lib/websocket.js:789:20)
at Receiver.emit (events.js:198:13)
at Receiver.dataMessage (/Users/jneto/workspace/knot/cloud/knot-cloud/node_modules/ws/lib/receiver.js:422:14)
at Receiver.getData (/Users/jneto/workspace/knot/cloud/knot-cloud/node_modules/ws/lib/receiver.js:352:17)
at Receiver.startLoop (/Users/jneto/workspace/knot/cloud/knot-cloud/node_modules/ws/lib/receiver.js:138:22)
at Receiver._write (/Users/jneto/workspace/knot/cloud/knot-cloud/node_modules/ws/lib/receiver.js:74:10)
at doWrite (_stream_writable.js:415:12)
frame:
'{"type":"error","data":{"code":403,"message":"The thing undefined has no schema for sensor id 1"}}',
code: 403 }
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the setData command that triggers the 403 error, then trace the Client.onMessage entry point shown in the stack trace to find where the error message is assembled. The work is done when the message identifies the relevant thing instead of displaying "undefined" while retaining the sensor ID and no-schema context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100