- /**
- * Check the validity of the result.
- *
- * @param response response of rpc
- * @return {@link DOMRpcResult} result
- */
- @VisibleForTesting
- static DOMRpcResult checkResponse(final DOMRpcResult response) {
- if (response == null) {
- return null;
- }
- try {
- if (response.getErrors().isEmpty()) {
- return response;
- }
- LOG.debug("RpcError message {}", response.getErrors());
- throw new RestconfDocumentedException("RPCerror message ", null, response.getErrors());
- } catch (final CancellationException e) {
- final String errMsg = "The operation was cancelled while executing.";
- LOG.debug("Cancel RpcExecution: {}", errMsg, e);
- throw new RestconfDocumentedException(errMsg, ErrorType.RPC, ErrorTag.PARTIAL_OPERATION, e);
- }
- }
-