eclipse-thingweb / eclipse-thingweb/node-wot

[core][credentials] Adding credentials should handle wrong ids

Open
#277 18 comments 0 reactions 0 assignees View on GitHub
core
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.