Restconf return 500 Server Error if YangPatch body is incorrect
Description
If the ietf-yang-patch:yang-patch modeled body is incorrect in the part parsed by Restconf, then in any case of unchecked Exception during model parsing, Restconf returns 500. For example, this can occur with a missing required leaf node or with a leaf node with an invalid value
To reproduce send request with missing "patch-id": "patch1" or change operation from merge to WRONG
Environment
None
Attachments
2
Activity
Show:
Ivan Hraško last month
Netty based endpoint freezes in this situation (not even returning 500):
Ivan Hraško March 17, 2025 at 9:20 AM
Edited
There are multiple places which can fail with runtime exceptions.
There are multiple possibilities to solve this issue:
check at the moment of reading that element from payload
catch Exception somewhere
catch Exception in endpoint and response with RequestException
The developer has decided for option #1 because it:
fails fast
we know exactly where the problem arises
it can help to LOG and throw dedicated exception messages
If the
ietf-yang-patch:yang-patch
modeled body is incorrect in the part parsed by Restconf, then in any case of unchecked Exception during model parsing, Restconf returns 500. For example, this can occur with a missing required leaf node or with a leaf node with an invalid valueTo reproduce send request with missing
"patch-id": "patch1"
or change operation frommerge
toWRONG