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:
parent
8dd04742a0
commit
ce5e0d7208
1 changed files with 3 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue