import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.mdsal.dom.api.DOMActionResult;
import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@Beta
}
public SimpleDOMActionResult(final ContainerNode output) {
- this.errors = ImmutableList.of();
+ errors = ImmutableList.of();
this.output = requireNonNull(output);
}
this(errors, requireNonNull(output));
}
+ // As per RFC7950 page 80 (top)
+ public static SimpleDOMActionResult ofMalformedMessage(final Exception cause) {
+ return new SimpleDOMActionResult(ImmutableList.of(RpcResultBuilder.newError(ErrorType.RPC,
+ ErrorTag.MALFORMED_MESSAGE, cause.getMessage(), null, null, requireNonNull(cause))), null);
+ }
+
@Override
public Collection<RpcError> getErrors() {
return errors;
}
return helper.toString();
}
-}
\ No newline at end of file
+}