Define a replacement for Restconf{Error,Exception,Future} 63/111363/8
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 11 Apr 2024 23:33:24 +0000 (01:33 +0200)
committerRobert Varga <nite@hq.sk>
Sun, 14 Apr 2024 07:08:48 +0000 (07:08 +0000)
commit1168cbc3b3ae493f05d73a7d02ab69ba35cc055e
tree8067f23025e1e719e2afd76b4dc9d30d21112b03
parent4007ec19eed842466aaac39a4f65b5c36c624a31
Define a replacement for Restconf{Error,Exception,Future}

Server-side API is opinionated about how it reports errors. This patch
defines:
- ErrorMessage to hold the RFC6241 definition of what is an error
  message
- ServerError to replace RestconfError
- ServerErrorInfo to hold the error-info element
- ServerErrorPath to hold the error-path element
- ServerException to replace RestconfDocumentedException

ServerException has a more logical API, holding only a single error and
performing explicit mapping when instantiated with just a Throwable
cause. This mode of operation maps:
- IllegalArgumentException to ErrorTag.INVALID_VALUE
- UnsupportedOperationException to ErrorTag.OPERATION_NOT_SUPPORTED

JIRA: NETCONF-1188
Change-Id: I07e7a9a56e4e02c699ead96bed1c115136767c4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
protocol/restconf-api/src/main/java/org/opendaylight/restconf/api/ErrorMessage.java [new file with mode: 0644]
restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java
restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfError.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/DatabindPath.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/ServerError.java [new file with mode: 0644]
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/ServerErrorInfo.java [new file with mode: 0644]
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/ServerErrorPath.java [new file with mode: 0644]
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/ServerException.java [new file with mode: 0644]
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/package-info.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/server/api/ServerExceptionTest.java [new file with mode: 0644]