Search in sources :

Example 6 with ErrorType

use of org.opendaylight.yangtools.yang.common.ErrorType in project netconf by opendaylight.

the class NetconfRestconfTransaction method toCommitFailedException.

@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static TransactionCommitFailedException toCommitFailedException(final Collection<? extends RpcError> errors) {
    ErrorType errType = ErrorType.APPLICATION;
    ErrorSeverity errSeverity = ErrorSeverity.ERROR;
    StringJoiner msgBuilder = new StringJoiner(" ");
    ErrorTag errorTag = ErrorTag.OPERATION_FAILED;
    for (final RpcError error : errors) {
        errType = error.getErrorType().toNetconf();
        errSeverity = error.getSeverity().toNetconf();
        msgBuilder.add(error.getMessage());
        msgBuilder.add(error.getInfo());
        errorTag = new ErrorTag(error.getTag());
    }
    return new TransactionCommitFailedException("Netconf transaction commit failed", new NetconfDocumentedException("RPC during tx failed. " + msgBuilder.toString(), errType, errorTag, errSeverity));
}
Also used : TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) ErrorTag(org.opendaylight.yangtools.yang.common.ErrorTag) ErrorType(org.opendaylight.yangtools.yang.common.ErrorType) RpcError(org.opendaylight.yangtools.yang.common.RpcError) NetconfDocumentedException(org.opendaylight.netconf.api.NetconfDocumentedException) ErrorSeverity(org.opendaylight.yangtools.yang.common.ErrorSeverity) StringJoiner(java.util.StringJoiner) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

ErrorTag (org.opendaylight.yangtools.yang.common.ErrorTag)6 ErrorType (org.opendaylight.yangtools.yang.common.ErrorType)6 Test (org.junit.Test)3 RestconfError (org.opendaylight.restconf.common.errors.RestconfError)3 ErrorSeverity (org.opendaylight.yangtools.yang.common.ErrorSeverity)3 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)2 NetconfDocumentedException (org.opendaylight.netconf.api.NetconfDocumentedException)2 RpcError (org.opendaylight.yangtools.yang.common.RpcError)2 StringJoiner (java.util.StringJoiner)1 TransactionCommitFailedException (org.opendaylight.mdsal.common.api.TransactionCommitFailedException)1 DOMRpcResult (org.opendaylight.mdsal.dom.api.DOMRpcResult)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1