lordgamez commented on code in PR #2289:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2289#discussion_r4514426970


##########
extensions/opc/src/BaseOPCProcessor.cpp:
##########
@@ -143,4 +145,74 @@ void BaseOPCProcessor::parseNode(core::ProcessContext& 
context, const core::Prop
   }
 }
 
+std::expected<void, std::string> BaseOPCProcessor::resolvePathNode() {
+  if (id_type_ != opc::OPCNodeIDType::Path || path_node_id_resolved_) {
+    return {};
+  }
+  auto node = resolveSingleNodePath(node_id_, namespace_idx_, 
path_reference_types_);
+  if (!node) {
+    return std::unexpected{node.error()};
+  }
+  node_ = std::move(*node);
+  path_node_id_resolved_ = true;
+  return {};
+}
+
+std::expected<BaseOPCProcessor::TargetNode, std::string> 
BaseOPCProcessor::resolveTargetNode(core::ProcessContext& context,
+    const core::FlowFile& flow_file, const TargetNodeProperties& properties) 
const {
+  const auto namespace_idx_str = 
context.getProperty(properties.namespace_index, &flow_file).value_or("");
+  UA_UInt16 namespace_idx = 0;
+  try {
+    namespace_idx = gsl::narrow<UA_UInt16>(std::stoul(namespace_idx_str));
+  } catch (const std::exception&) {
+    return std::unexpected{fmt::format("invalid target node namespace index 
'{}'", namespace_idx_str)};
+  }

Review Comment:
   I think it's clear enough that the empty string is also an invalid input for 
the namespace



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to