Improve error messaging in YangPatch 72/115872/26 master
authorPeter Suna <peter.suna@pantheon.tech>
Tue, 11 Mar 2025 16:49:07 +0000 (17:49 +0100)
committerIvan Hrasko <ivan.hrasko@pantheon.tech>
Fri, 2 May 2025 11:32:45 +0000 (11:32 +0000)
commit1a156775aa33b58c11dad24ff6103f7fd9176a64
treef01eec6c790415b572ac7bf8f8aac5975a7da3bd
parent1f3f801317614dd35ec02cc3b8e2dab9bd66bc59
Improve error messaging in YangPatch

The method readValueNodes returns exception message
"Error parsing input" for several error cases.
Fix this by handling each error case individually with a proper
error message.

Fix ErrorType from PROTOCOL to APLICATION, since this error
is not related to the NETCONF protocol.

Fix ErrorTag from MALFORMED_MESSAGE to MISSING_ELEMENT when 'value'
element is required and missing, and to UNKNOWN_ELEMENT when 'value'
element is provided for DELETE, MOVE and REMOVE operation.

Fix JsonPatchBodyTest target path to throw correct exception.

JIRA: NETCONF-1438
Change-Id: I9226ede2d664c1c8c24db1bccc7f412ab929eb34
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
apps/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/databind/JsonPatchBodyTest.java
apps/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/databind/XmlPatchBodyTest.java
protocol/restconf-server-api/src/main/java/org/opendaylight/restconf/server/api/JsonPatchBody.java
protocol/restconf-server-api/src/main/java/org/opendaylight/restconf/server/api/PatchBody.java
protocol/restconf-server-api/src/main/java/org/opendaylight/restconf/server/api/XmlPatchBody.java