edgexfoundry / device-sdk-c

Owner: Device WG
Apache License 2.0
42 stars 42 forks source link

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. #495

Open pranavkumaradarji-eaton opened 12 months ago

pranavkumaradarji-eaton commented 12 months ago

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,