net: lwm2m: response nicely when obj not found or OP not handled

1) Respond NOT FOUND to caller when object doesn't exist
2) Report as internal server error when OP not handled

Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
This commit is contained in:
Robert Chou 2017-08-28 17:20:27 +08:00 committed by Anas Nashif
commit ce5e0d7208

View file

@ -2330,7 +2330,8 @@ static int handle_request(struct zoap_packet *request,
obj = get_engine_obj(path.obj_id);
if (!obj) {
/* No matching object found - ignore request */
return -ENOENT;
r = -ENOENT;
goto error;
}
format = select_reader(&in, format);
@ -2475,7 +2476,7 @@ static int handle_request(struct zoap_packet *request,
default:
SYS_LOG_ERR("Unknown operation: %u", context.operation);
return -EINVAL;
r = -EINVAL;
}
if (r) {