edgexfoundry / edgexfoundry/device-sdk-c
Getting InternalServerError 500 instead of Bad Input 400 when trying to set a device resource value with some wrong/invalid parameter in PUT handler of service's command request.
- Dominant language
- C
- Stars
- 45
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
Relevant Package [REQUIRED]
We are facing this with our customized service when trying to update/set a device channel resource value with the wrong/invalid parameter. We want to return the 4xx code, due to an invalid data set by the client. But no provision to return the other code except 200/500 in the PUT handler of the service's device command.
Description [REQUIRED]
We are currently getting "InternalServerError, 500" when trying to set a device resource value with some wrong/invalid parameter. The expected error with the status code should be "Bad Input, 400".
We observed that there is only provision to return 200(True) or 500 (False) errors, the "edgex-sdk-c" should be improved to return a REST standard error code 4xx,
Contributor guide
Research direction
Start with the service's device-command PUT handler in edgex-sdk-c and trace how invalid parameters are converted to the handler's success or failure result. Define and verify the 400 response for client-invalid input while preserving the existing 200 and 500 behavior for other outcomes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100