eclipse-thingweb / eclipse-thingweb/node-wot
[core][credentials] Adding credentials should handle wrong ids
- Dominant language
- TypeScript
- Stars
- 192
- Forks
- 100
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 6
Description
Currently, the line that adds the credential for each Thing based on their `id` does not handle wrong `id`s given by the developer and when the credential for the Thing based on the `id` of the TD is gotten, it crashes with generic error message that doesn't help to spot the error (cannot read property of undefined). There should be a try/catch or another construct around it that gives an error message like "id provided in the credentials does not correspond to the `id` of the Thing in its TD". I think that this error handling needs to happen when they are gotten since when adding the credentials, there may be no TD in the servient.
Where the credentials are stored:
https://github.com/eclipse/thingweb.node-wot/blob/d647247fe14d2384653910699c3324597f606282/packages/core/src/servient.ts#L276
Where they are gotten:
https://github.com/eclipse/thingweb.node-wot/blob/d647247fe14d2384653910699c3324597f606282/packages/core/src/servient.ts#L282
Contributor guide
Assessment
This issue has not been assessed yet.