CESARBR / CESARBR/knot-cloud-protocol-adapter-websocket

Show appropriate error when data isn’t passed as an array to setData command

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
0
Forks
3
PR merge metrics
No merged PRs in 30d

Description

The error is currently being threw as follows:

```
{ Error: dataList.forEach is not a function
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":500,"message":"dataList.forEach is not a function"}}',
code: 500 }
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the setData command handling and reproduce the issue by passing a non-array value where dataList is expected. Confirm the current dataList.forEach failure, then define and verify an appropriate validation error for invalid input; the issue does not name a source file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.