szaszm commented on a change in pull request #1042:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1042#discussion_r637002796



##########
File path: libminifi/src/core/Processor.cpp
##########
@@ -386,6 +379,38 @@ std::shared_ptr<Connectable> 
Processor::pickIncomingConnection() {
   return getNextIncomingConnectionImpl(rel_guard);
 }
 
+void Processor::validateAnnotations() const {
+  switch (getInputRequirement()) {
+    case annotation::Input::INPUT_REQUIRED: {
+      if (!hasIncomingConnections()) {
+        throw Exception(PROCESS_SCHEDULE_EXCEPTION, "INPUT_REQUIRED was 
specified for the processor, but no inputs were found");

Review comment:
       I would rather refer to incoming connections in the error message.
   ```suggestion
           throw Exception(PROCESS_SCHEDULE_EXCEPTION, "INPUT_REQUIRED was 
specified for the processor, but no incoming connections were found");
   ```

##########
File path: libminifi/src/core/Processor.cpp
##########
@@ -386,6 +379,38 @@ std::shared_ptr<Connectable> 
Processor::pickIncomingConnection() {
   return getNextIncomingConnectionImpl(rel_guard);
 }
 
+void Processor::validateAnnotations() const {
+  switch (getInputRequirement()) {
+    case annotation::Input::INPUT_REQUIRED: {
+      if (!hasIncomingConnections()) {
+        throw Exception(PROCESS_SCHEDULE_EXCEPTION, "INPUT_REQUIRED was 
specified for the processor, but no inputs were found");
+      }
+      return;
+    }
+    case annotation::Input::INPUT_ALLOWED:
+      return;
+    case annotation::Input::INPUT_FORBIDDEN: {
+      if (hasIncomingConnections()) {
+        throw Exception(PROCESS_SCHEDULE_EXCEPTION, "INPUT_FORBIDDEN was 
specified for the processor, but at least one input was found");

Review comment:
       ```suggestion
           throw Exception(PROCESS_SCHEDULE_EXCEPTION, "INPUT_FORBIDDEN was 
specified for the processor, but there are incoming connections");
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to